fixes for XML render

This commit is contained in:
Anna Bodnia
2017-03-22 16:14:20 +02:00
parent bfa7214cdf
commit 4ebe2273da
7 changed files with 117 additions and 52 deletions

View File

@@ -396,7 +396,7 @@ describe("createXMLExample", function () {
})
it("returns array with default values with wrapped=true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n</animals>"
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
items: {
"enum": ["one", "two"],
@@ -405,6 +405,7 @@ describe("createXMLExample", function () {
name: "animal"
}
},
"default": ["1", "2"],
xml: {
wrapped: true,
name: "animals"
@@ -413,8 +414,53 @@ describe("createXMLExample", function () {
expect(sut(definition)).toEqual(expected)
})
it("returns array with example values with ", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
type: "object",
properties: {
"animal": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"1",
"2"
]
}
},
xml: {
name: "animals"
}
}
expect(sut(definition)).toEqual(expected)
})
it("returns array with example values with wrapped=true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
type: "array",
items: {
type: "string",
xml: {
name: "animal"
}
},
"example": [ "1", "2" ],
xml: {
wrapped: true,
name: "animals"
}
}
expect(sut(definition)).toEqual(expected)
})
})
describe("object", function () {
it("returns object with 2 properties", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"