Skip to content

Commit f244e56

Browse files
committed
improve if then else tests
1 parent d9aaea9 commit f244e56

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

test/src/Convertor.spec.js

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,9 @@ describe('Convertor', () => {
384384
const result = newConvertor.convert('basic')
385385
expect(result.schemas.basic.properties).to.have.property('street_address')
386386
expect(result.schemas.basic.properties).to.have.property('country')
387-
// expect(result.schemas.basic.properties.names.type).to.be.equal('array')
388-
// expect(result.schemas.basic.properties.names.items).to.be.an('object')
389-
// expect(result.schemas.basic.properties.names.items).to.not.be.an('array')
387+
expect(result.schemas.basic).to.have.property('oneOf')
388+
expect(result.schemas.basic.oneOf).to.be.an('array')
389+
expect(result.schemas.basic.oneOf.length).to.be.equal(2)
390390

391391
const cloned = JSON.parse(JSON.stringify(basicOpenAPI))
392392
Object.assign(cloned, {components: result})
@@ -402,9 +402,9 @@ describe('Convertor', () => {
402402
const result = newConvertor.convert('basic')
403403
expect(result.schemas.basic.properties).to.have.property('street_address')
404404
expect(result.schemas.basic.properties).to.have.property('country')
405-
// expect(result.schemas.basic.properties.names.type).to.be.equal('array')
406-
// expect(result.schemas.basic.properties.names.items).to.be.an('object')
407-
// expect(result.schemas.basic.properties.names.items).to.not.be.an('array')
405+
expect(result.schemas.basic).to.have.property('oneOf')
406+
expect(result.schemas.basic.oneOf).to.be.an('array')
407+
expect(result.schemas.basic.oneOf.length).to.be.equal(1)
408408

409409
const cloned = JSON.parse(JSON.stringify(basicOpenAPI))
410410
Object.assign(cloned, {components: result})
@@ -420,9 +420,9 @@ describe('Convertor', () => {
420420
const result = newConvertor.convert('basic')
421421
expect(result.schemas.basic.properties).to.have.property('street_address')
422422
expect(result.schemas.basic.properties).to.have.property('country')
423-
// expect(result.schemas.basic.properties.names.type).to.be.equal('array')
424-
// expect(result.schemas.basic.properties.names.items).to.be.an('object')
425-
// expect(result.schemas.basic.properties.names.items).to.not.be.an('array')
423+
expect(result.schemas.basic).to.have.property('oneOf')
424+
expect(result.schemas.basic.oneOf).to.be.an('array')
425+
expect(result.schemas.basic.oneOf.length).to.be.equal(1)
426426

427427
const cloned = JSON.parse(JSON.stringify(basicOpenAPI))
428428
Object.assign(cloned, {components: result})
@@ -438,9 +438,7 @@ describe('Convertor', () => {
438438
const result = newConvertor.convert('basic')
439439
expect(result.schemas.basic.properties).to.have.property('street_address')
440440
expect(result.schemas.basic.properties).to.have.property('country')
441-
// expect(result.schemas.basic.properties.names.type).to.be.equal('array')
442-
// expect(result.schemas.basic.properties.names.items).to.be.an('object')
443-
// expect(result.schemas.basic.properties.names.items).to.not.be.an('array')
441+
expect(result.schemas.basic).to.not.have.property('oneOf')
444442

445443
const cloned = JSON.parse(JSON.stringify(basicOpenAPI))
446444
Object.assign(cloned, {components: result})
@@ -456,9 +454,7 @@ describe('Convertor', () => {
456454
const result = newConvertor.convert('basic')
457455
expect(result.schemas.basic.properties).to.have.property('street_address')
458456
expect(result.schemas.basic.properties).to.have.property('country')
459-
// expect(result.schemas.basic.properties.names.type).to.be.equal('array')
460-
// expect(result.schemas.basic.properties.names.items).to.be.an('object')
461-
// expect(result.schemas.basic.properties.names.items).to.not.be.an('array')
457+
expect(result.schemas.basic).to.not.have.property('oneOf')
462458

463459
const cloned = JSON.parse(JSON.stringify(basicOpenAPI))
464460
Object.assign(cloned, {components: result})
@@ -474,9 +470,7 @@ describe('Convertor', () => {
474470
const result = newConvertor.convert('basic')
475471
expect(result.schemas.basic.properties).to.have.property('street_address')
476472
expect(result.schemas.basic.properties).to.have.property('country')
477-
// expect(result.schemas.basic.properties.names.type).to.be.equal('array')
478-
// expect(result.schemas.basic.properties.names.items).to.be.an('object')
479-
// expect(result.schemas.basic.properties.names.items).to.not.be.an('array')
473+
expect(result.schemas.basic).to.not.have.property('oneOf')
480474

481475
const cloned = JSON.parse(JSON.stringify(basicOpenAPI))
482476
Object.assign(cloned, {components: result})
@@ -492,9 +486,7 @@ describe('Convertor', () => {
492486
const result = newConvertor.convert('basic')
493487
expect(result.schemas.basic.properties).to.have.property('street_address')
494488
expect(result.schemas.basic.properties).to.have.property('country')
495-
// expect(result.schemas.basic.properties.names.type).to.be.equal('array')
496-
// expect(result.schemas.basic.properties.names.items).to.be.an('object')
497-
// expect(result.schemas.basic.properties.names.items).to.not.be.an('array')
489+
expect(result.schemas.basic).to.not.have.property('oneOf')
498490

499491
const cloned = JSON.parse(JSON.stringify(basicOpenAPI))
500492
Object.assign(cloned, {components: result})

0 commit comments

Comments
 (0)