Skip to content

Commit 1af69d0

Browse files
committed
explain the tests in a comment
1 parent 05edaf1 commit 1af69d0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/core/integ/pagination.integ.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,19 @@ describe("pagination", () => {
9696
expect.assertions(7);
9797
});
9898

99+
/**
100+
* This test makes a DynamoDB paginated batch get request for 5 items, with keys 1-2-3-4-5, in this exact order.
101+
*
102+
* The first returned page contains items 2 and 1 (order switched to simulate the unpredictability of the order of the
103+
* items returned by the DDB API BatchGetItem command), plus unprocessed keys 3 and 4. The second page contains the
104+
* items 3 and 4, and no further unprocessed keys.
105+
*
106+
* Item 5 is asked for, but we consider that the table does not contain it, so it's not returned at all. That's a
107+
* valid use case and does not generate an error.
108+
*
109+
* In the second part of the test, another paginated request is done for 2 items, with keys 1 and 1. So the same
110+
* item is requested twice. As the API will return an error, we want to catch the generated SDK exception.
111+
*/
99112
it("processes batch items until all items are processed or an error is received", async () => {
100113
const ddb = new DynamoDB({
101114
credentials: {

0 commit comments

Comments
 (0)