Skip to content

Commit 5bafec4

Browse files
anandgupta42claude
andcommitted
test(drivers): describe the Mongo byte-limit test as consumption, not fetching
The mock cursor ignores the batch size, so the test checks how many documents the byte budget consumes; the real driver may prefetch up to one reply batch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e8ba318 commit 5bafec4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/drivers/test/source-byte-limit.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ async function mongo(docs: Record<string, unknown>[]) {
143143
return { connector, consumed: () => consumed, closed: () => closed, batchSize: () => batchSize }
144144
}
145145

146-
test.each(["find", "aggregate"])("Mongo %s closes the cursor before fetching past maxResultBytes", async (command) => {
147-
const db = await mongo([{ value: "a" }, { value: "x".repeat(100) }, { value: "must not be fetched" }])
146+
// The mock cursor yields documents one at a time whatever the batch size; `consumed` counts documents the
147+
// byte budget iterated. The real driver may prefetch up to one reply batch, which the budget never reads.
148+
test.each(["find", "aggregate"])("Mongo %s stops consuming at maxResultBytes and reads in bounded batches", async (command) => {
149+
const db = await mongo([{ value: "a" }, { value: "x".repeat(100) }, { value: "must not be consumed" }])
148150
try {
149151
await expect(
150152
db.connector.execute(JSON.stringify({ command, collection: "source", pipeline: [] }), 100, undefined, {

0 commit comments

Comments
 (0)