Archived
Add protocol selection to Claude and Codex provider forms referencing CCSwitch
This commit is contained in:
1 parent
bae24cc439
commit
16957decb2
14 files changed
+274
-25
No files matched your search
@@ -139,4 +139,28 @@ describe("Codex page", () => {
|
||||
await user.click(await screen.findByRole("button", { name: /还原官方配置|Restore official config/ }));
|
||||
await waitFor(() => expect(restore).toHaveBeenCalledWith({ target: "codex" }));
|
||||
});
|
||||
|
||||
it("renders protocol options and submits selected protocol for Codex", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderWithProviders(<Codex />);
|
||||
await user.click(await screen.findByRole("button", { name: /新增供应商|Add provider/ }));
|
||||
const select = screen.getByLabelText(/协议选择|Protocol/);
|
||||
expect(select).toBeInTheDocument();
|
||||
expect(screen.getByRole("option", { name: /OpenAI Responses API/ })).toBeInTheDocument();
|
||||
expect(screen.getByRole("option", { name: /OpenAI Chat Completions/ })).toBeInTheDocument();
|
||||
expect(screen.getByRole("option", { name: /Anthropic Messages/ })).toBeInTheDocument();
|
||||
|
||||
await user.selectOptions(select, "openai_responses");
|
||||
await user.type(screen.getByLabelText(/名称|Name/), "OpenAI-Direct");
|
||||
await user.type(screen.getByLabelText(/Base URL/), "https://api.openai.com/v1");
|
||||
await user.type(screen.getByLabelText(/API Key/), "sk-oa");
|
||||
await user.click(screen.getByRole("button", { name: /保存|Save/ }));
|
||||
await waitFor(() => expect(createProvider).toHaveBeenCalledTimes(1));
|
||||
const input = createProvider.mock.calls[0][0];
|
||||
expect(input).toMatchObject({
|
||||
name: "OpenAI-Direct",
|
||||
protocol: "openai_responses",
|
||||
target: "codex",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user