Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline (Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/* packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
25 lines
856 B
TypeScript
25 lines
856 B
TypeScript
import type { BackgroundJob, JobPublisher } from "@rakazo/adapter-kit";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import { deferFutureRoutine } from "./executor.js";
|
|
|
|
describe("routine scheduling", () => {
|
|
it("never fires a future occurrence early", async () => {
|
|
const scheduledAt = new Date(Date.now() + 60_000);
|
|
const enqueue = vi.fn(async (_job: BackgroundJob) => undefined);
|
|
const jobs: JobPublisher = {
|
|
enqueue,
|
|
cancel: async () => undefined,
|
|
close: async () => undefined,
|
|
};
|
|
|
|
expect(await deferFutureRoutine(jobs, "routine-1", scheduledAt)).toBe(true);
|
|
|
|
expect(enqueue).toHaveBeenCalledWith({
|
|
name: "routine.wakeup",
|
|
payload: { routineId: "routine-1", scheduledFor: scheduledAt.toISOString() },
|
|
availableAt: scheduledAt,
|
|
replaceKey: "routine:routine-1",
|
|
});
|
|
});
|
|
});
|