mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Clone components argument to keep tests independent
This commit is contained in:
@@ -93,13 +93,15 @@ describe('DEREF FUNCTION TESTS ', function() {
|
||||
}
|
||||
},
|
||||
parameterSource = 'REQUEST',
|
||||
output = deref.resolveRefs(schema, parameterSource, componentsAndPaths),
|
||||
output_withdot = deref.resolveRefs(schemaWithDotInKey, parameterSource, componentsAndPaths),
|
||||
output_customFormat = deref.resolveRefs(schemaWithCustomFormat, parameterSource, componentsAndPaths),
|
||||
output_withAllOf = deref.resolveRefs(schemaWithAllOf, parameterSource, componentsAndPaths),
|
||||
output_validationTypeArray = deref.resolveRefs(schemaWithTypeArray, parameterSource, componentsAndPaths,
|
||||
{}, 'VALIDATION'),
|
||||
output_emptyObject = deref.resolveRefs(schemaWithEmptyObject, parameterSource, componentsAndPaths);
|
||||
// deref.resolveRefs modifies the input schema and components so cloning to keep tests independent of each other
|
||||
output = deref.resolveRefs(schema, parameterSource, _.cloneDeep(componentsAndPaths)),
|
||||
output_withdot = deref.resolveRefs(schemaWithDotInKey, parameterSource, _.cloneDeep(componentsAndPaths)),
|
||||
output_customFormat = deref.resolveRefs(schemaWithCustomFormat, parameterSource,
|
||||
_.cloneDeep(componentsAndPaths)),
|
||||
output_withAllOf = deref.resolveRefs(schemaWithAllOf, parameterSource, _.cloneDeep(componentsAndPaths)),
|
||||
output_validationTypeArray = deref.resolveRefs(schemaWithTypeArray, parameterSource,
|
||||
_.cloneDeep(componentsAndPaths), {}, 'VALIDATION'),
|
||||
output_emptyObject = deref.resolveRefs(schemaWithEmptyObject, parameterSource, _.cloneDeep(componentsAndPaths));
|
||||
|
||||
expect(output).to.deep.include({ type: 'object',
|
||||
required: ['id'],
|
||||
@@ -116,7 +118,7 @@ describe('DEREF FUNCTION TESTS ', function() {
|
||||
type: 'object',
|
||||
description: 'Schema 2',
|
||||
properties: {
|
||||
id: { default: '<long>', type: 'integer', format: 'int64' },
|
||||
id: { default: '<long>', type: 'integer' },
|
||||
test_prop: { default: '<string>', type: 'string' }
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user