forked from loafle/openapi-generator-original
[js] fix boolean in oneOf, add tests (#14380)
This commit is contained in:
@@ -280,6 +280,20 @@ describe('Petstore', function() {
|
||||
expect(JSON.stringify(result)).to.be(nested_one_of_json);
|
||||
});
|
||||
|
||||
it('should serialize and deserialize StringOrBoolean correctly', function() {
|
||||
// string
|
||||
var json = '"Hello World"'
|
||||
var result = OpenAPIPetstore.ApiClient.convertToType(JSON.parse(json), OpenAPIPetstore.StringOrBoolean);
|
||||
expect(result).to.be.a(OpenAPIPetstore.StringOrBoolean);
|
||||
expect(JSON.stringify(result)).to.be(json);
|
||||
|
||||
// boolean
|
||||
json = 'true'
|
||||
result = OpenAPIPetstore.ApiClient.convertToType(JSON.parse(json), OpenAPIPetstore.StringOrBoolean);
|
||||
expect(result).to.be.a(OpenAPIPetstore.StringOrBoolean);
|
||||
expect(JSON.stringify(result)).to.be(json);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user