mirror of https://github.com/openclaw/openclaw.git
test: harden command queue timer cleanup
This commit is contained in:
parent
1877a2ea26
commit
2fa3a09137
|
|
@ -1,4 +1,4 @@
|
|||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { importFreshModule } from "../../test/helpers/import-fresh.js";
|
||||
import { CommandLane } from "./lanes.js";
|
||||
|
||||
|
|
@ -74,6 +74,7 @@ describe("command queue", () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useRealTimers();
|
||||
resetCommandQueueStateForTest();
|
||||
// Queue state is global across module instances, so reset main lane
|
||||
// concurrency explicitly to avoid cross-file leakage.
|
||||
|
|
@ -85,6 +86,10 @@ describe("command queue", () => {
|
|||
diagnosticMocks.diag.error.mockClear();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it("resetAllLanes is safe when no lanes have been created", () => {
|
||||
expect(getActiveTaskCount()).toBe(0);
|
||||
expect(() => resetAllLanes()).not.toThrow();
|
||||
|
|
|
|||
Loading…
Reference in New Issue