11import { expect , test , describe } from "bun:test" ;
22import { mkdtempSync , rmSync , writeFileSync } from "node:fs" ;
33import { homedir , tmpdir } from "node:os" ;
4- import { join } from "node:path" ;
4+ import { join , posix , win32 } from "node:path" ;
55import { startServer } from "../src/server" ;
66import {
77 claudeDesktopConfigLibraryDir ,
@@ -30,21 +30,21 @@ describe("Claude Desktop configLibrary resolution", () => {
3030 platform : "darwin" ,
3131 home : HOME ,
3232 } ) ;
33- expect ( dir ) . toBe ( join ( "/custom/user-data" , "configLibrary" ) ) ;
33+ expect ( dir ) . toBe ( posix . join ( "/custom/user-data" , "configLibrary" ) ) ;
3434 expect ( dir ) . not . toContain ( "-3p" ) ;
3535 } ) ;
3636
3737 test ( "the macOS default stays Claude-3p (regression guard for existing users)" , ( ) => {
3838 const dir = resolveConfigLibraryDir ( { env : { } , platform : "darwin" , home : HOME } ) ;
39- expect ( dir ) . toBe ( join ( HOME , "Library" , "Application Support" , "Claude-3p" , "configLibrary" ) ) ;
39+ expect ( dir ) . toBe ( posix . join ( HOME , "Library" , "Application Support" , "Claude-3p" , "configLibrary" ) ) ;
4040 } ) ;
4141
4242 test ( "win32 with LOCALAPPDATA resolves under LOCALAPPDATA, not the macOS tree" , ( ) => {
4343 const env = { LOCALAPPDATA : "C:\\Users\\tester\\AppData\\Local" } ;
4444 const win = resolveConfigLibraryDir ( { env, platform : "win32" , home : HOME } ) ;
4545 const mac = resolveConfigLibraryDir ( { env, platform : "darwin" , home : HOME } ) ;
4646
47- expect ( win ) . toBe ( join ( "C:\\Users\\tester\\AppData\\Local" , "Claude-3p" , "configLibrary" ) ) ;
47+ expect ( win ) . toBe ( win32 . join ( "C:\\Users\\tester\\AppData\\Local" , "Claude-3p" , "configLibrary" ) ) ;
4848 // The defect was returning the macOS path on Windows: prove the branch diverges.
4949 expect ( win ) . not . toBe ( mac ) ;
5050 expect ( win ) . not . toContain ( "Application Support" ) ;
@@ -56,14 +56,14 @@ describe("Claude Desktop configLibrary resolution", () => {
5656 platform : "win32" ,
5757 home : HOME ,
5858 } ) ;
59- expect ( dir ) . toBe ( `${ join ( "C:\\Users\\tester\\AppData\\Roaming" , "Claude" ) } -3p` ) ;
59+ expect ( dir ) . toBe ( `${ win32 . join ( "C:\\Users\\tester\\AppData\\Roaming" , "Claude" ) } -3p` ) ;
6060 } ) ;
6161
6262 test ( "linux uses XDG_CONFIG_HOME when set, otherwise ~/.config" , ( ) => {
6363 expect ( resolveElectronUserData ( { env : { XDG_CONFIG_HOME : "/xdg" } , platform : "linux" , home : HOME } ) )
64- . toBe ( join ( "/xdg" , "Claude" ) ) ;
64+ . toBe ( posix . join ( "/xdg" , "Claude" ) ) ;
6565 expect ( resolveConfigLibraryDir ( { env : { } , platform : "linux" , home : HOME } ) )
66- . toBe ( join ( HOME , ".config" , "Claude-3p" , "configLibrary" ) ) ;
66+ . toBe ( posix . join ( HOME , ".config" , "Claude-3p" , "configLibrary" ) ) ;
6767 } ) ;
6868
6969 test ( "a userData root already ending in -3p is not double-suffixed" , ( ) => {
0 commit comments