Add extra testcase to base.dereference test suite

This commit is contained in:
Roman Hotsiy 2015-12-13 00:04:27 +02:00
parent b67c3e8d50
commit 0c6ded776a
2 changed files with 30 additions and 0 deletions

View File

@ -84,9 +84,29 @@ describe('BaseComponent', () => {
it('should resolve nested schema', () => {
expect(paramWithRef.properties.subschema.$ref).to.not.exist;
paramWithRef._pointer.should.be.equal('#/definitions/Nested');
paramWithRef.properties.subschema._pointer.should.be.equal('#/definitions/Simple');
paramWithRef.properties.subschema.type.should.be.equal('object');
});
});
describe('array schema dereference', () => {
let paramWithRef;
before(() => {
component.pointer = '/paths/test3/get';
component.onInit();
component.dereference();
paramWithRef = component.componentSchema.parameters[0];
});
it('should resolve array schema', () => {
expect(paramWithRef.$ref).to.not.exist;
expect(paramWithRef.items.schema.$ref).to.not.exist;
paramWithRef.type.should.be.equal('array');
paramWithRef._pointer.should.be.equal('#/definitions/ArrayOfSimple');
paramWithRef.items.schema._pointer.should.be.equal('#/definitions/Simple');
paramWithRef.items.schema.type.should.be.equal('object');
});
});
});
});

View File

@ -53,6 +53,16 @@
}
]
}
},
"test3": {
"get": {
"summary": "test get",
"parameters": [
{
"$ref": "#/definitions/ArrayOfSimple"
}
]
}
}
}
}