Skip to content

Commit

Permalink
Merge branch 'v2' of github.com:dynamoose/dynamoose into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
fishcharlie committed Jan 22, 2022
2 parents 5c15432 + e7063be commit 1b8b61d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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"
},
Expand Down
18 changes: 16 additions & 2 deletions test/unit/Document.js
Expand Up @@ -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": {},
Expand Down Expand Up @@ -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);
});
}
Expand Down

0 comments on commit 1b8b61d

Please sign in to comment.