Unified · Split
| @@ -39,9 +39,9 @@ describe("xdgDataHome", () => { · 38 unmodified lines | |||
| 39 | 39 | ||
| 40 | test("ignores empty / whitespace-only XDG_DATA_HOME", () => { | 40 | test("ignores empty / whitespace-only XDG_DATA_HOME", () => { |
| 41 | vi.stubEnv("XDG_DATA_HOME", " "); | 41 | vi.stubEnv("XDG_DATA_HOME", " "); |
| 42 | vi.stubEnv("HOME", "/home/rhys"); | 42 | vi.stubEnv("HOME", "/home/user"); |
| 43 | stubPlatform("linux"); | 43 | stubPlatform("linux"); |
| 44 | expect(xdgDataHome()).toBe("/home/rhys/.local/share"); | 44 | expect(xdgDataHome()).toBe("/home/user/.local/share"); |
| 45 | }); | 45 | }); |
| 46 | 46 | ||
| 47 | test("trims whitespace around XDG_DATA_HOME", () => { | 47 | test("trims whitespace around XDG_DATA_HOME", () => { |
| @@ -54,8 +54,8 @@ describe("xdgDataHome", () => { · 6 unmodified lines | |||
| 54 | beforeEach(() => stubPlatform("linux")); | 54 | beforeEach(() => stubPlatform("linux")); |
| 55 | 55 | ||
| 56 | test("falls back to $HOME/.local/share", () => { | 56 | test("falls back to $HOME/.local/share", () => { |
| 57 | vi.stubEnv("HOME", "/home/rhys"); | 57 | vi.stubEnv("HOME", "/home/user"); |
| 58 | expect(xdgDataHome()).toBe("/home/rhys/.local/share"); | 58 | expect(xdgDataHome()).toBe("/home/user/.local/share"); |
| 59 | }); | 59 | }); |
| 60 | 60 | ||
| 61 | test("defaults to ~/.local/share when HOME is unset", () => { | 61 | test("defaults to ~/.local/share when HOME is unset", () => { |
| @@ -67,25 +67,25 @@ describe("xdgDataHome", () => { · 5 unmodified lines | |||
| 67 | beforeEach(() => stubPlatform("win32")); | 67 | beforeEach(() => stubPlatform("win32")); |
| 68 | 68 | ||
| 69 | test("prefers LOCALAPPDATA", () => { | 69 | test("prefers LOCALAPPDATA", () => { |
| 70 | vi.stubEnv("LOCALAPPDATA", "C:\\Users\\rhys\\AppData\\Local"); | 70 | vi.stubEnv("LOCALAPPDATA", "C:\\Users\\user\\AppData\\Local"); |
| 71 | vi.stubEnv("APPDATA", "C:\\Users\\rhys\\AppData\\Roaming"); | 71 | vi.stubEnv("APPDATA", "C:\\Users\\user\\AppData\\Roaming"); |
| 72 | vi.stubEnv("USERPROFILE", "C:\\Users\\rhys"); | 72 | vi.stubEnv("USERPROFILE", "C:\\Users\\user"); |
| 73 | expect(xdgDataHome()).toBe("C:\\Users\\rhys\\AppData\\Local"); | 73 | expect(xdgDataHome()).toBe("C:\\Users\\user\\AppData\\Local"); |
| 74 | }); | 74 | }); |
| 75 | 75 | ||
| 76 | test("falls back to APPDATA when LOCALAPPDATA is unset", () => { | 76 | test("falls back to APPDATA when LOCALAPPDATA is unset", () => { |
| 77 | vi.stubEnv("APPDATA", "C:\\Users\\rhys\\AppData\\Roaming"); | 77 | vi.stubEnv("APPDATA", "C:\\Users\\user\\AppData\\Roaming"); |
| 78 | vi.stubEnv("USERPROFILE", "C:\\Users\\rhys"); | 78 | vi.stubEnv("USERPROFILE", "C:\\Users\\user"); |
| 79 | expect(xdgDataHome()).toBe("C:\\Users\\rhys\\AppData\\Roaming"); | 79 | expect(xdgDataHome()).toBe("C:\\Users\\user\\AppData\\Roaming"); |
| 80 | }); | 80 | }); |
| 81 | 81 | ||
| 82 | test("falls back to USERPROFILE\\AppData\\Local when both are unset", () => { | 82 | test("falls back to USERPROFILE\\AppData\\Local when both are unset", () => { |
| 83 | vi.stubEnv("USERPROFILE", "C:\\Users\\rhys"); | 83 | vi.stubEnv("USERPROFILE", "C:\\Users\\user"); |
| 84 | // The helper uses node:path.join which normalizes separators to the | 84 | // The helper uses node:path.join which normalizes separators to the |
| 85 | // runtime platform, so on a POSIX test runner we can't assert the | 85 | // runtime platform, so on a POSIX test runner we can't assert the |
| 86 | // exact separator — just that all three segments are present. | 86 | // exact separator — just that all three segments are present. |
| 87 | const result = xdgDataHome(); | 87 | const result = xdgDataHome(); |
| 88 | expect(result).toContain("C:\\Users\\rhys"); | 88 | expect(result).toContain("C:\\Users\\user"); |
| 89 | expect(result).toContain("AppData"); | 89 | expect(result).toContain("AppData"); |
| 90 | expect(result).toContain("Local"); | 90 | expect(result).toContain("Local"); |
| 91 | }); | 91 | }); |