Skip to content

Commit

Permalink
test(lib-dynamodb): adding additional test cases for function properties
Browse files Browse the repository at this point in the history
  • Loading branch information
siddsriv committed Jan 24, 2024
1 parent a9246f3 commit 9f9db09
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion lib/lib-dynamodb/src/commands/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,61 @@ describe("object with function property", () => {
const keyNodes = { Item: {} };
const nativeAttrObj = { Item: { id: 1, func: () => {} }, ...notAttrValue };
const attrObj = { Item: { id: { N: "1" } }, ...notAttrValue };

it(marshallInput.name, () => {
expect(marshallInput(nativeAttrObj, keyNodes, { convertTopLevelContainer: true })).toEqual(attrObj);
});

// List of functions
const listOfFunctions = { Item: { id: 1, funcs: [() => {}, () => {}] }, ...notAttrValue };
it(marshallInput.name, () => {
expect(
marshallInput(listOfFunctions, keyNodes, { convertTopLevelContainer: true, convertClassInstanceToMap: true })
).toEqual(attrObj);
});

// Nested list of functions
const nestedListOfFunctions = {
Item: {
id: 1,
funcs: [
[() => {}, () => {}],
[() => {}, () => {}],
],
},
...notAttrValue,
};
it(marshallInput.name, () => {
expect(
marshallInput(nestedListOfFunctions, keyNodes, {
convertTopLevelContainer: true,
convertClassInstanceToMap: true,
})
).toEqual(attrObj);
});

// Nested list of functions 3 levels down
const nestedListOfFunctions3Levels = {
Item: {
id: 1,
funcs: [
[
[() => {}, () => {}],
[() => {}, () => {}],
],
[
[() => {}, () => {}],
[() => {}, () => {}],
],
],
},
...notAttrValue,
};
it(marshallInput.name, () => {
expect(
marshallInput(nestedListOfFunctions3Levels, keyNodes, {
convertTopLevelContainer: true,
convertClassInstanceToMap: true,
})
).toEqual(attrObj);
});
});

0 comments on commit 9f9db09

Please sign in to comment.