@remit/drizzle-service 0.0.74 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -321,6 +321,57 @@ describe("DrizzleThreadMessageRepository.searchByMailboxWindow / countByMailbox"
|
|
|
321
321
|
);
|
|
322
322
|
assert.equal(count, 5, "asc counts the whole match set too");
|
|
323
323
|
});
|
|
324
|
+
|
|
325
|
+
// ── Scenario 7 ────────────────────────────────────────────────────────────
|
|
326
|
+
// The count and the result set are two answers to one predicate, and the
|
|
327
|
+
// surfaces that render the number stopped paging to derive it (#307). This
|
|
328
|
+
// is the guard from the other direction: walk every page and assert the walk
|
|
329
|
+
// and the count agree, so the number cannot silently drift from the rows.
|
|
330
|
+
test("the count agrees with a full page-through of the same predicate", async () => {
|
|
331
|
+
const acct = uuid();
|
|
332
|
+
const mbx = uuid();
|
|
333
|
+
const now = Date.now();
|
|
334
|
+
await seed(acct, mbx, [
|
|
335
|
+
...Array.from({ length: 17 }, (_, i) => ({
|
|
336
|
+
subject: `gamma ${i}`,
|
|
337
|
+
sentDate: now - i,
|
|
338
|
+
internalDate: now - i,
|
|
339
|
+
})),
|
|
340
|
+
{ subject: "delta", sentDate: now - 100, internalDate: now - 100 },
|
|
341
|
+
]);
|
|
342
|
+
|
|
343
|
+
const walked = new Set<string>();
|
|
344
|
+
let continuationToken: string | undefined;
|
|
345
|
+
let pages = 0;
|
|
346
|
+
do {
|
|
347
|
+
const page = await repo.searchByMailboxWindow(
|
|
348
|
+
acct,
|
|
349
|
+
mbx,
|
|
350
|
+
{ subject: "gamma" },
|
|
351
|
+
{ excludeDeleted: true, limit: 5, continuationToken },
|
|
352
|
+
);
|
|
353
|
+
for (const row of page.items) walked.add(row.threadMessageId);
|
|
354
|
+
continuationToken = page.continuationToken;
|
|
355
|
+
pages += 1;
|
|
356
|
+
} while (continuationToken && pages < 10);
|
|
357
|
+
assert.ok(
|
|
358
|
+
!continuationToken,
|
|
359
|
+
"the walk never reached the end of the pages",
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
const count = await repo.countByMailbox(
|
|
363
|
+
acct,
|
|
364
|
+
mbx,
|
|
365
|
+
{ subject: "gamma" },
|
|
366
|
+
{ excludeDeleted: true },
|
|
367
|
+
);
|
|
368
|
+
assert.equal(
|
|
369
|
+
count,
|
|
370
|
+
walked.size,
|
|
371
|
+
"the count and the rows the predicate returns disagree",
|
|
372
|
+
);
|
|
373
|
+
assert.equal(count, 17, "the unmatched row leaked into one of the two");
|
|
374
|
+
});
|
|
324
375
|
});
|
|
325
376
|
|
|
326
377
|
// ─── searchByDate: the unified listing's cross-folder search mode ─────────────
|