Skip to content

Commit 9f9db09

Browse files
committed
test(lib-dynamodb): adding additional test cases for function properties
1 parent a9246f3 commit 9f9db09

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

lib/lib-dynamodb/src/commands/utils.spec.ts

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,61 @@ describe("object with function property", () => {
152152
const keyNodes = { Item: {} };
153153
const nativeAttrObj = { Item: { id: 1, func: () => {} }, ...notAttrValue };
154154
const attrObj = { Item: { id: { N: "1" } }, ...notAttrValue };
155-
156155
it(marshallInput.name, () => {
157156
expect(marshallInput(nativeAttrObj, keyNodes, { convertTopLevelContainer: true })).toEqual(attrObj);
158157
});
158+
159+
// List of functions
160+
const listOfFunctions = { Item: { id: 1, funcs: [() => {}, () => {}] }, ...notAttrValue };
161+
it(marshallInput.name, () => {
162+
expect(
163+
marshallInput(listOfFunctions, keyNodes, { convertTopLevelContainer: true, convertClassInstanceToMap: true })
164+
).toEqual(attrObj);
165+
});
166+
167+
// Nested list of functions
168+
const nestedListOfFunctions = {
169+
Item: {
170+
id: 1,
171+
funcs: [
172+
[() => {}, () => {}],
173+
[() => {}, () => {}],
174+
],
175+
},
176+
...notAttrValue,
177+
};
178+
it(marshallInput.name, () => {
179+
expect(
180+
marshallInput(nestedListOfFunctions, keyNodes, {
181+
convertTopLevelContainer: true,
182+
convertClassInstanceToMap: true,
183+
})
184+
).toEqual(attrObj);
185+
});
186+
187+
// Nested list of functions 3 levels down
188+
const nestedListOfFunctions3Levels = {
189+
Item: {
190+
id: 1,
191+
funcs: [
192+
[
193+
[() => {}, () => {}],
194+
[() => {}, () => {}],
195+
],
196+
[
197+
[() => {}, () => {}],
198+
[() => {}, () => {}],
199+
],
200+
],
201+
},
202+
...notAttrValue,
203+
};
204+
it(marshallInput.name, () => {
205+
expect(
206+
marshallInput(nestedListOfFunctions3Levels, keyNodes, {
207+
convertTopLevelContainer: true,
208+
convertClassInstanceToMap: true,
209+
})
210+
).toEqual(attrObj);
211+
});
159212
});

0 commit comments

Comments
 (0)