Add PostgreSQL-backed background worker
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { nextDueDate } from "../../web/src/server/services/recurring-invoices";
|
||||
|
||||
describe("recurring invoice scheduling", () => {
|
||||
test("advances weekly schedules from their scheduled occurrence", () => {
|
||||
const scheduledFor = new Date("2026-08-17T12:00:00.000Z");
|
||||
expect(nextDueDate("weekly", scheduledFor).toISOString()).toBe(
|
||||
"2026-08-24T12:00:00.000Z",
|
||||
);
|
||||
});
|
||||
|
||||
test("does not mutate the source date", () => {
|
||||
const scheduledFor = new Date("2026-08-17T12:00:00.000Z");
|
||||
nextDueDate("monthly", scheduledFor);
|
||||
expect(scheduledFor.toISOString()).toBe("2026-08-17T12:00:00.000Z");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user