Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
477 changes: 50 additions & 427 deletions apps/desktop/src/preview/Manager.test.ts

Large diffs are not rendered by default.

45 changes: 15 additions & 30 deletions apps/desktop/src/wsl/wslPathParsing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,40 +79,25 @@ describe("parseWslDistroList", () => {
});

describe("extractDistroFromUncPath", () => {
it("extracts the distro from \\\\wsl.localhost UNC paths", () => {
expect(extractDistroFromUncPath("\\\\wsl.localhost\\Ubuntu-22.04\\home\\josh")).toBe(
"Ubuntu-22.04",
);
});

it("extracts the distro from the legacy \\\\wsl$ UNC paths", () => {
expect(extractDistroFromUncPath("\\\\wsl$\\Debian\\home\\josh")).toBe("Debian");
});

it("returns null for non-UNC Windows paths", () => {
expect(extractDistroFromUncPath("C:\\Users\\Josh\\project")).toBeNull();
});

it("returns null when the segment is not a valid distro name", () => {
expect(extractDistroFromUncPath("\\\\wsl.localhost\\bad name!\\home")).toBeNull();
it.each([
["\\\\wsl.localhost\\Ubuntu-22.04\\home\\josh", "Ubuntu-22.04"],
["\\\\wsl$\\Debian\\home\\josh", "Debian"],
["C:\\Users\\Josh\\project", null],
["\\\\wsl.localhost\\bad name!\\home", null],
] as const)("extracts the distro from %s as %s", (path, expected) => {
expect(extractDistroFromUncPath(path)).toBe(expected);
});
});

describe("wslUncPathToLinuxPath", () => {
it("maps WSL UNC paths back to Linux absolute paths", () => {
expect(wslUncPathToLinuxPath("\\\\wsl.localhost\\Ubuntu-22.04\\home\\josh\\repo")).toBe(
"/home/josh/repo",
);
});

it("maps a distro UNC root to Linux root", () => {
expect(wslUncPathToLinuxPath("\\\\wsl$\\Debian")).toBe("/");
expect(wslUncPathToLinuxPath("\\\\wsl.localhost\\Debian\\")).toBe("/");
});

it("rejects invalid distro names and non-WSL paths", () => {
expect(wslUncPathToLinuxPath("\\\\wsl.localhost\\bad!name\\home")).toBeNull();
expect(wslUncPathToLinuxPath("C:\\Users\\Josh\\repo")).toBeNull();
it.each([
["\\\\wsl.localhost\\Ubuntu-22.04\\home\\josh\\repo", "/home/josh/repo"],
["\\\\wsl$\\Debian", "/"],
["\\\\wsl.localhost\\Debian\\", "/"],
["\\\\wsl.localhost\\bad!name\\home", null],
["C:\\Users\\Josh\\repo", null],
] as const)("converts %s to %s", (path, expected) => {
expect(wslUncPathToLinuxPath(path)).toBe(expected);
});
});

Expand Down
6 changes: 0 additions & 6 deletions apps/mobile/src/lib/mobileTheme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ describe("mobile themes", () => {
expect(
contrastRatio(variables["--color-placeholder"], variables["--color-input"]),
).toBeGreaterThanOrEqual(4.5);
}
}

for (const themeId of BUILT_IN_THEME_IDS) {
for (const appearance of ["light", "dark"] as const) {
const variables = getMobileThemeVariables(themeId, appearance);
expect(
contrastRatio(
variables["--color-user-bubble-foreground"],
Expand Down
Loading
Loading