forked from Emanuele-web04/synara
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathEnvironmentPanel.logic.test.ts
More file actions
72 lines (65 loc) · 2.15 KB
/
Copy pathEnvironmentPanel.logic.test.ts
File metadata and controls
72 lines (65 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vitest";
import {
getRepositoryLabel,
UPSTREAM_AMNESIA_HINT,
UPSTREAM_AMNESIA_LABEL,
} from "./EnvironmentPanel";
import { shouldShowStudioFolderRow } from "./EnvironmentPanel.logic";
describe("shouldShowStudioFolderRow", () => {
it("shows a picked Studio reference folder only when the native shell can open it", () => {
expect(
shouldShowStudioFolderRow({
isStudioChat: true,
studioFolderPath: "/Users/tester/Projects/demo",
nativeShellAvailable: true,
}),
).toBe(true);
expect(
shouldShowStudioFolderRow({
isStudioChat: true,
studioFolderPath: "/Users/tester/Projects/demo",
nativeShellAvailable: false,
}),
).toBe(false);
});
it("hides the row outside Studio and when no folder was picked", () => {
expect(
shouldShowStudioFolderRow({
isStudioChat: false,
studioFolderPath: "/Users/tester/Projects/demo",
nativeShellAvailable: true,
}),
).toBe(false);
expect(
shouldShowStudioFolderRow({
isStudioChat: true,
studioFolderPath: null,
nativeShellAvailable: true,
}),
).toBe(false);
});
});
describe("getRepositoryLabel", () => {
it("shows the upstream repository when amnesia is disabled", () => {
const markup = renderToStaticMarkup(
getRepositoryLabel({
githubRepository: { nameWithOwner: "openai/codex", url: "https://github.com/openai/codex" },
hideUpstreamRepositoryInfo: false,
}),
);
expect(markup).toContain("openai/codex");
expect(markup).not.toContain(UPSTREAM_AMNESIA_LABEL);
});
it("hides upstream identity with amnesia messaging when enabled", () => {
const markup = renderToStaticMarkup(
getRepositoryLabel({
githubRepository: { nameWithOwner: "openai/codex", url: "https://github.com/openai/codex" },
hideUpstreamRepositoryInfo: true,
}),
);
expect(markup).toContain(UPSTREAM_AMNESIA_LABEL);
expect(markup).toContain(UPSTREAM_AMNESIA_HINT);
expect(markup).not.toContain("openai/codex");
});
});