diff --git a/package-lock.json b/package-lock.json index e04b6e94f..be1426a8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "license": "Unlicense", "dependencies": { "aws-sdk": "^2.968.0", - "js-object-utilities": "^2.0.0", + "js-object-utilities": "^2.1.0", "source-map-support": "^0.5.19", "uuid": "^8.3.2" }, @@ -2402,9 +2402,9 @@ } }, "node_modules/js-object-utilities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/js-object-utilities/-/js-object-utilities-2.0.0.tgz", - "integrity": "sha512-d0o5Hnd+9q9mswk8VhU9Fzl+QLce3FvtNlLKV7UTUYjAZuChAKeS/DnuameOpiJAXquqrXLJYUcABxhIWogwpA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/js-object-utilities/-/js-object-utilities-2.1.0.tgz", + "integrity": "sha512-X62npvVTfyNELV4gPU4jJSzFZbdxk3zH/FxlBrZ6n+AGKpGyhMpsPs00tjtqTLy582zG4bvaG5fuKMm/zA1gng==", "license": "UNLICENSE" }, "node_modules/js-tokens": { @@ -5675,9 +5675,9 @@ "version": "0.15.0" }, "js-object-utilities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/js-object-utilities/-/js-object-utilities-2.0.0.tgz", - "integrity": "sha512-d0o5Hnd+9q9mswk8VhU9Fzl+QLce3FvtNlLKV7UTUYjAZuChAKeS/DnuameOpiJAXquqrXLJYUcABxhIWogwpA==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/js-object-utilities/-/js-object-utilities-2.1.0.tgz", + "integrity": "sha512-X62npvVTfyNELV4gPU4jJSzFZbdxk3zH/FxlBrZ6n+AGKpGyhMpsPs00tjtqTLy582zG4bvaG5fuKMm/zA1gng==" }, "js-tokens": { "version": "4.0.0", diff --git a/package.json b/package.json index 95b188c33..7e77d1333 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "dependencies": { "aws-sdk": "^2.968.0", - "js-object-utilities": "^2.0.0", + "js-object-utilities": "^2.1.0", "source-map-support": "^0.5.19", "uuid": "^8.3.2" }, diff --git a/test/unit/Document.js b/test/unit/Document.js index 3bea1036c..27f9df870 100644 --- a/test/unit/Document.js +++ b/test/unit/Document.js @@ -2058,6 +2058,19 @@ describe("Document", () => { "output": {"someField": "hello"}, "schema": {"someField": {"type": String, "required": true}, "someFieldAndMore": {"type": String, "required": true}} }, + { + "input": [(() => { + let object = { + "id": 1 + }; + object.array = {"first": 1}; + object.array2 = object; + return object; + })(), {"saveUnknown": true}], + "output": {"id": 1}, + "schema": {"id": Number}, + "inputJSONString": JSON.stringify({"id": 1, "array": {"first": 1}, "array2": "CIRCULAR"}) + }, // Defaults { "input": {}, @@ -2797,12 +2810,13 @@ describe("Document", () => { }; const testFunc = test.test || it; + const inputJSONString = test.inputJSONString || JSON.stringify(test.input); if (test.error) { - testFunc(`Should throw error ${JSON.stringify(test.error)} for input of ${JSON.stringify(test.input)}`, () => { + testFunc(`Should throw error ${JSON.stringify(test.error)} for input of ${inputJSONString}`, () => { return expect(func().model.objectFromSchema(...func().input)).to.be.rejectedWith(test.error.message); }); } else { - testFunc(`Should return ${JSON.stringify(test.output)} for input of ${JSON.stringify(test.input)} with a schema of ${JSON.stringify(test.schema)}`, async () => { + testFunc(`Should return ${JSON.stringify(test.output)} for input of ${inputJSONString} with a schema of ${JSON.stringify(test.schema)}`, async () => { expect(await func().model.objectFromSchema(...func().input)).to.eql(test.output); }); }