ソースを参照

Add tests

bubble
Kyle Shockey 7年前
コミット
37f9d5aa29
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: DC20D559FFBC0D36
1個のファイルの変更63行の追加0行の削除
  1. +63
    -0
      test/core/plugins/samples/fn.js

+ 63
- 0
test/core/plugins/samples/fn.js ファイルの表示

@@ -554,6 +554,69 @@ describe("createXMLExample", function () {
expect(sut(definition, { includeReadOnly: false })).toEqual(expected)
})

it("returns object with readonly fields for parameter, with includeReadOnly", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
var definition = {
type: "object",
properties: {
id: {
type: "integer"
},
dog: {
readOnly: true,
type: "string"
}
},
xml: {
name: "animals"
}
}

expect(sut(definition, { includeReadOnly: true })).toEqual(expected)
})

it("returns object without writeonly fields for parameter", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
var definition = {
type: "object",
properties: {
id: {
type: "integer"
},
dog: {
writeOnly: true,
type: "string"
}
},
xml: {
name: "animals"
}
}

expect(sut(definition)).toEqual(expected)
})

it("returns object with writeonly fields for parameter, with includeWriteOnly", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
var definition = {
type: "object",
properties: {
id: {
type: "integer"
},
dog: {
writeOnly: true,
type: "string"
}
},
xml: {
name: "animals"
}
}

expect(sut(definition, { includeWriteOnly: true })).toEqual(expected)
})

it("returns object with passed property as attribute", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals id=\"0\">\n\t<dog>string</dog>\n</animals>"
var definition = {


読み込み中…
キャンセル
保存