diff --git a/test/unit/deref.test.js b/test/unit/deref.test.js index 4d9ef4a..1e0f2c8 100644 --- a/test/unit/deref.test.js +++ b/test/unit/deref.test.js @@ -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: '', type: 'integer', format: 'int64' }, + id: { default: '', type: 'integer' }, test_prop: { default: '', type: 'string' } } });