File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { resolveStateDir } from "../config/paths.js";
1010import { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js" ;
1111import { createEmptyPluginRegistry } from "../plugins/registry-empty.js" ;
1212import { resetPluginRuntimeStateForTest , setActivePluginRegistry } from "../plugins/runtime.js" ;
13+ import { withEnvAsync } from "../test-utils/env.js" ;
1314import { resizeToJpeg } from "./media-services.js" ;
1415import { encodePngRgba , fillPixel } from "./png-encode.js" ;
1516
@@ -585,17 +586,14 @@ describe("loadWebMedia", () => {
585586 } ) ;
586587
587588 it ( "resolves home-relative local media paths through allowed local roots" , async ( ) => {
588- vi . stubEnv ( "OPENCLAW_HOME" , fixtureRoot ) ;
589- try {
589+ await withEnvAsync ( { OPENCLAW_HOME : fixtureRoot } , async ( ) => {
590590 const result = await loadWebMedia ( "~/workspace/chart.png" , {
591591 maxBytes : 1024 * 1024 ,
592592 localRoots : [ workspaceDir ] ,
593593 } ) ;
594594 expect ( result . kind ) . toBe ( "image" ) ;
595595 expect ( result . buffer . length ) . toBeGreaterThan ( 0 ) ;
596- } finally {
597- vi . unstubAllEnvs ( ) ;
598- }
596+ } ) ;
599597 } ) ;
600598
601599 it ( "allows validated host-read TXT files" , async ( ) => {
You can’t perform that action at this time.
0 commit comments