mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 05:12:15 +00:00
Tests: force-reset session cleanup state between runs
This commit is contained in:
@@ -2,10 +2,13 @@ import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { resetSessionWriteLockStateForTest } from "../agents/session-write-lock.js";
|
||||
import {
|
||||
clearSessionStoreCacheForTest,
|
||||
getSessionStoreLockQueueSizeForTest,
|
||||
withSessionStoreLockForTest,
|
||||
} from "../config/sessions/store.js";
|
||||
import { resetFileLockStateForTest } from "../infra/file-lock.js";
|
||||
import { cleanupSessionStateForTest } from "./session-state-cleanup.js";
|
||||
|
||||
const acquireSessionWriteLockMock = vi.hoisted(() =>
|
||||
@@ -32,11 +35,16 @@ function createDeferred<T>() {
|
||||
|
||||
describe("cleanupSessionStateForTest", () => {
|
||||
beforeEach(() => {
|
||||
clearSessionStoreCacheForTest();
|
||||
resetFileLockStateForTest();
|
||||
resetSessionWriteLockStateForTest();
|
||||
acquireSessionWriteLockMock.mockClear();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanupSessionStateForTest();
|
||||
afterEach(() => {
|
||||
clearSessionStoreCacheForTest();
|
||||
resetFileLockStateForTest();
|
||||
resetSessionWriteLockStateForTest();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user