Open History to see the last commit
1import { EnvironmentId } from "@t3tools/contracts";
2import { describe, expect, it } from "vite-plus/test";
3
4import { fileManagerActionForPath, shouldShowOpenInPicker } from "./OpenInPicker.logic";
5
6describe("shouldShowOpenInPicker", () => {
7 it("shows both local environments when the primary has a separate WSL home", () => {
8 const primaryEnvironmentId = EnvironmentId.make("wsl");
9 const hostEnvironmentId = EnvironmentId.make("host");
10 for (const [activeThreadEnvironmentId, visible] of [
11 [primaryEnvironmentId, true],
12 [hostEnvironmentId, true],
13 [EnvironmentId.make("other"), false],
14 ] as const) {
15 expect(
16 shouldShowOpenInPicker({
17 activeProjectName: "Project",
18 activeThreadEnvironmentId,
19 primaryEnvironmentId,
20 hostEnvironmentId,
21 remoteOpenMode: "local-exec",
22 }),
23 ).toBe(visible);
24 }
25 });
26});
27
28describe("fileManagerActionForPath", () => {
29 it("opens only folders and shows a file once its read settled on a server that can", () => {
30 for (const [isFolder, isSettled, canReveal, action] of [
31 [true, false, false, "open"],
32 [false, false, true, "unavailable"],
33 [false, true, false, "unavailable"],
34 [false, true, true, "reveal"],
35 ] as const) {
36 expect(fileManagerActionForPath({ isFolder, isSettled, canReveal })).toBe(action);
37 }
38 });
39});