Skip to content

Commit e282cb2

Browse files
committed
test: contain media roots state env
1 parent 6f419b3 commit e282cb2

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/media/local-roots.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Local media root tests cover allowed root normalization and matching.
22
import path from "node:path";
33
import { pathToFileURL } from "node:url";
4-
import { afterEach, describe, expect, it, vi } from "vitest";
4+
import { describe, expect, it } from "vitest";
5+
import { withEnv } from "../test-utils/env.js";
56
import {
67
appendLocalMediaParentRoots,
78
buildMediaLocalRoots,
@@ -16,8 +17,7 @@ function normalizeHostPath(value: string): string {
1617

1718
describe("local media roots", () => {
1819
function withStateDir<T>(stateDir: string, run: () => T): T {
19-
vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
20-
return run();
20+
return withEnv({ OPENCLAW_STATE_DIR: stateDir }, run);
2121
}
2222

2323
function expectNormalizedRootsContain(
@@ -73,10 +73,6 @@ describe("local media roots", () => {
7373
}
7474
}
7575

76-
afterEach(() => {
77-
vi.unstubAllEnvs();
78-
});
79-
8076
it.each([
8177
{
8278
name: "keeps temp, media cache, canvas, and workspace roots by default",

0 commit comments

Comments
 (0)