test: check models command workspace args

This commit is contained in:
Shakker
2026-05-11 15:35:50 +01:00
parent 8f66462125
commit 99bac079ed

View File

@@ -186,9 +186,8 @@ describe("handleModelsCommand", () => {
expect(result?.reply?.text).toContain("Use: /models <provider>");
expect(result?.reply?.text).toContain("Switch: /model <provider/model>");
expect(result?.reply?.text).not.toContain("Add: /models add");
expect(modelProviderAuthMocks.createProviderAuthChecker).toHaveBeenCalledWith(
expect.objectContaining({ workspaceDir: "/tmp" }),
);
const authCheckerParams = modelProviderAuthMocks.createProviderAuthChecker.mock.calls[0]?.[0];
expect(authCheckerParams?.workspaceDir).toBe("/tmp");
});
it("hides unauthenticated providers by default and keeps all as explicit browse", async () => {
@@ -391,12 +390,9 @@ describe("handleModelsCommand", () => {
const result = await handleModelsCommand(params, true);
expect(result?.reply?.text).toContain("Models (anthropic · 🔑 target-auth) — showing 1-2 of 2");
expect(modelAuthLabelMocks.resolveModelAuthLabel).toHaveBeenCalledWith(
expect.objectContaining({
provider: "anthropic",
workspaceDir: "/tmp",
}),
);
const authLabelParams = modelAuthLabelMocks.resolveModelAuthLabel.mock.calls[0]?.[0];
expect(authLabelParams?.provider).toBe("anthropic");
expect(authLabelParams?.workspaceDir).toBe("/tmp");
});
it("uses spawned workspace for direct /models provider visibility", async () => {
@@ -414,9 +410,8 @@ describe("handleModelsCommand", () => {
const result = await handleModelsCommand(params, true);
expect(result?.reply?.text).toContain("- anthropic (2)");
expect(modelProviderAuthMocks.createProviderAuthChecker).toHaveBeenCalledWith(
expect.objectContaining({ workspaceDir: "/tmp/spawned-workspace" }),
);
const authCheckerParams = modelProviderAuthMocks.createProviderAuthChecker.mock.calls[0]?.[0];
expect(authCheckerParams?.workspaceDir).toBe("/tmp/spawned-workspace");
});
it("returns a deprecation message for /models add when no provider is given", async () => {