Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update marshall tests
Browse files Browse the repository at this point in the history
trivikr committed Dec 23, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 22a9863 commit 6f79f56
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/util-dynamodb/src/marshall.spec.ts
Original file line number Diff line number Diff line change
@@ -15,18 +15,20 @@ describe("marshall", () => {
});

it("calls convertToAttr", () => {
// @ts-ignore output mocked for testing
expect(marshall(input)).toEqual(input);
expect(convertToAttr).toHaveBeenCalledTimes(1);
expect(convertToAttr).toHaveBeenCalledWith(input, undefined);
});

[false, true].forEach((convertEmptyValues) => {
it(`passes convertEmptyValues=${convertEmptyValues} to convertToAttr`, () => {
// @ts-ignore output mocked for testing
expect(marshall(input, { convertEmptyValues })).toEqual(input);
expect(convertToAttr).toHaveBeenCalledTimes(1);
expect(convertToAttr).toHaveBeenCalledWith(input, { convertEmptyValues });
["convertEmptyValues", "removeUndefinedValues"].forEach((option) => {
describe(`options.${option}`, () => {
[false, true].forEach((value) => {
it(`passes ${value} to convertToAttr`, () => {
expect(marshall(input, { [option]: value })).toEqual(input);
expect(convertToAttr).toHaveBeenCalledTimes(1);
expect(convertToAttr).toHaveBeenCalledWith(input, { [option]: value });
});
});
});
});
});

0 comments on commit 6f79f56

Please sign in to comment.