mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
26 lines
733 B
TypeScript
26 lines
733 B
TypeScript
// @vitest-environment jsdom
|
|
|
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
import { createChatViewDeferredTasks } from "../../../../src/features/chat/host/session/deferred-work";
|
|
|
|
describe("createChatViewDeferredTasks", () => {
|
|
beforeEach(() => {
|
|
vi.useFakeTimers();
|
|
});
|
|
|
|
it("clears scheduled deferred work", async () => {
|
|
const tasks = createChatViewDeferredTasks(() => window);
|
|
const diagnostics = vi.fn();
|
|
const warmup = vi.fn();
|
|
|
|
tasks.scheduleDiagnostics(diagnostics);
|
|
tasks.scheduleAppServerWarmup(warmup);
|
|
tasks.clearAll();
|
|
|
|
await vi.advanceTimersByTimeAsync(1_500);
|
|
|
|
expect(diagnostics).not.toHaveBeenCalled();
|
|
expect(warmup).not.toHaveBeenCalled();
|
|
});
|
|
});
|