feat: make queues durable by default and add seed helpers
Quality / quality (ubuntu-latest) (push) Failing after 11m1s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-23 09:50:25 +05:30
parent 8fb96f521f
commit 46195462c3
22 changed files with 283 additions and 15 deletions
+3
View File
@@ -3,6 +3,7 @@ import { createDurableQueue, defineQueue, memoryQueueStore } from "../src/index.
test("defineQueue creates typed producers and registers workers", async () => {
const seen: number[] = [];
const completed: number[] = [];
const email = defineQueue({
name: "email",
options: { store: memoryQueueStore() },
@@ -15,6 +16,7 @@ test("defineQueue creates typed producers and registers workers", async () => {
data !== null &&
Number.isInteger((data as { messageId?: unknown }).messageId),
run: async ({ messageId }: { messageId: number }) => void seen.push(messageId),
success: async ({ messageId }: { messageId: number }) => void completed.push(messageId),
},
},
});
@@ -25,6 +27,7 @@ test("defineQueue creates typed producers and registers workers", async () => {
expect(await email.send.status(first.id)).toBe("queued");
expect(await email.drain()).toBe(1);
expect(seen).toEqual([7]);
expect(completed).toEqual([7]);
expect(await email.send.status(first.id)).toBe("completed");
});