Description
When using mock-aws-s3-v3 to test code that relies on S3 pagination, the mock does not return ContinuationToken or NextContinuationToken for ListObjectsV2Command responses. As a result, any logic that depends on paginated listings cannot be tested using this library.
According to AWS S3 behavior, when the number of returned objects exceeds MaxKeys, the response should include:
- IsTruncated: true
- NextContinuationToken: "[token]"
- and should accept ContinuationToken in the next request
The mock currently returns the full object list with no pagination, and both tokens remain undefined.
Steps to reproduce
import { S3Client, ListObjectsV2Command } from "@aws-sdk/client-s3";
import { mockClient } from "mock-aws-s3-v3";
const mock = mockClient(S3Client);
mock.on(ListObjectsV2Command).resolves({
Contents: [...Array(200).keys()].map(i => ({ Key: `file-${i}` })),
// Expecting pagination when > MaxKeys (default 1000 or custom)
});
const client = new S3Client({});
const res = await client.send(
new ListObjectsV2Command({
Bucket: "test-bucket",
MaxKeys: 10,
})
);
console.log(res.IsTruncated); // expected: true
console.log(res.NextContinuationToken); // expected: string
console.log(res.Contents.length); // expected: 10
Actual behavior
- Returning up to
MaxKeys number of objects
- But NextContinuationToken is undefined
Expected behavior
- Should return up to
MaxKeys number of objects
- Should return a NextContinuationToken
- Should take an optional ContinuationToken
Description
When using mock-aws-s3-v3 to test code that relies on S3 pagination, the mock does not return ContinuationToken or NextContinuationToken for ListObjectsV2Command responses. As a result, any logic that depends on paginated listings cannot be tested using this library.
According to AWS S3 behavior, when the number of returned objects exceeds MaxKeys, the response should include:
The mock currently returns the full object list with no pagination, and both tokens remain undefined.
Steps to reproduce
Actual behavior
MaxKeysnumber of objectsExpected behavior
MaxKeysnumber of objects