@@ -6,6 +6,21 @@ import { describe, expect, it } from "vitest";
66import { resolveZaloToken } from "./token.js" ;
77import type { ZaloConfig } from "./types.js" ;
88
9+ const canCreateFileSymlinks = ( ( ) => {
10+ const probeDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "openclaw-zalo-token-probe-" ) ) ;
11+ const targetFile = path . join ( probeDir , "target.txt" ) ;
12+ const linkFile = path . join ( probeDir , "link.txt" ) ;
13+ try {
14+ fs . writeFileSync ( targetFile , "target" , "utf8" ) ;
15+ fs . symlinkSync ( targetFile , linkFile , "file" ) ;
16+ return true ;
17+ } catch {
18+ return false ;
19+ } finally {
20+ fs . rmSync ( probeDir , { recursive : true , force : true } ) ;
21+ }
22+ } ) ( ) ;
23+
924describe ( "resolveZaloToken" , ( ) => {
1025 it ( "falls back to top-level token for non-default accounts without overrides" , ( ) => {
1126 const cfg = {
@@ -75,7 +90,7 @@ describe("resolveZaloToken", () => {
7590 expect ( res . source ) . toBe ( "config" ) ;
7691 } ) ;
7792
78- it . runIf ( process . platform !== "win32" ) ( "rejects symlinked token files" , ( ) => {
93+ it . skipIf ( ! canCreateFileSymlinks ) ( "rejects symlinked token files" , ( ) => {
7994 const dir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "openclaw-zalo-token-" ) ) ;
8095 const tokenFile = path . join ( dir , "token.txt" ) ;
8196 const tokenLink = path . join ( dir , "token-link.txt" ) ;
0 commit comments