-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathworkspace-preferred-model.test.tsx
51 lines (44 loc) · 1.29 KB
/
workspace-preferred-model.test.tsx
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
import { render } from "@/lib/test-utils";
import { screen, waitFor } from "@testing-library/react";
import { WorkspacePreferredModel } from "../workspace-preferred-model";
import userEvent from "@testing-library/user-event";
test("render model overrides", async () => {
render(
<WorkspacePreferredModel
isArchived={false}
workspaceName="fake-workspace"
/>,
);
expect(screen.getByText(/preferred model/i)).toBeVisible();
expect(
screen.getByText(
/select the model you would like to use in this workspace./i,
),
).toBeVisible();
expect(
screen.getByRole("button", { name: /select the model/i }),
).toBeVisible();
await waitFor(() => {
expect(screen.getByRole("button", { name: /save/i })).toBeVisible();
});
});
test("submit preferred model", async () => {
render(
<WorkspacePreferredModel
isArchived={false}
workspaceName="fake-workspace"
/>,
);
await userEvent.click(
screen.getByRole("button", { name: /select the model/i }),
);
await userEvent.click(
screen.getByRole("option", {
name: "anthropic/claude-3.5",
}),
);
await userEvent.click(screen.getByRole("button", { name: /save/i }));
await waitFor(() => {
expect(screen.getByText(/preferred model for fake-workspace updated/i));
});
});