mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 04:32:44 +00:00
refactor(test): centralize trigger and cron test helpers
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
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 { withTempDir } from "../test-utils/temp-dir.js";
|
||||
import {
|
||||
getChannelActivity,
|
||||
recordChannelActivity,
|
||||
@@ -20,15 +20,6 @@ import {
|
||||
setVoiceWakeTriggers,
|
||||
} from "./voicewake.js";
|
||||
|
||||
async function withTempDir(prefix: string, run: (dir: string) => Promise<void>) {
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), prefix));
|
||||
try {
|
||||
await run(dir);
|
||||
} finally {
|
||||
await fs.rm(dir, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
describe("infra store", () => {
|
||||
describe("state migrations fs", () => {
|
||||
it("treats array session stores as invalid", async () => {
|
||||
|
||||
Reference in New Issue
Block a user