mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
test: contain media roots state env
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
// Local media root tests cover allowed root normalization and matching.
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { withEnv } from "../test-utils/env.js";
|
||||
import {
|
||||
appendLocalMediaParentRoots,
|
||||
buildMediaLocalRoots,
|
||||
@@ -16,8 +17,7 @@ function normalizeHostPath(value: string): string {
|
||||
|
||||
describe("local media roots", () => {
|
||||
function withStateDir<T>(stateDir: string, run: () => T): T {
|
||||
vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
|
||||
return run();
|
||||
return withEnv({ OPENCLAW_STATE_DIR: stateDir }, run);
|
||||
}
|
||||
|
||||
function expectNormalizedRootsContain(
|
||||
@@ -73,10 +73,6 @@ describe("local media roots", () => {
|
||||
}
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: "keeps temp, media cache, canvas, and workspace roots by default",
|
||||
|
||||
Reference in New Issue
Block a user