mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 18:14:58 +00:00
test(perf): reduce timer teardown overhead in cron issue regressions
This commit is contained in:
@@ -2,7 +2,7 @@ import crypto from "node:crypto";
|
|||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import type { HeartbeatRunResult } from "../infra/heartbeat-wake.js";
|
import type { HeartbeatRunResult } from "../infra/heartbeat-wake.js";
|
||||||
import * as schedule from "./schedule.js";
|
import * as schedule from "./schedule.js";
|
||||||
import { CronService } from "./service.js";
|
import { CronService } from "./service.js";
|
||||||
@@ -157,17 +157,14 @@ describe("Cron issue regressions", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
vi.useFakeTimers();
|
vi.useFakeTimers();
|
||||||
vi.setSystemTime(new Date("2026-02-06T10:05:00.000Z"));
|
vi.setSystemTime(new Date("2026-02-06T10:05:00.000Z"));
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await fs.rm(fixtureRoot, { recursive: true, force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
vi.clearAllMocks();
|
await fs.rm(fixtureRoot, { recursive: true, force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("covers schedule updates and payload patching", async () => {
|
it("covers schedule updates and payload patching", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user