test: tighten auth choice model assertions · openclaw/openclaw@e3b2ddb
steipete
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
| 2 | +import type { AuthProfileStore } from "../agents/auth-profiles.js"; |
2 | 3 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
3 | 4 | import { warnIfModelConfigLooksOff } from "./auth-choice.model-check.js"; |
4 | 5 | import { makePrompter } from "./setup/__tests__/test-utils.js"; |
@@ -43,10 +44,13 @@ describe("warnIfModelConfigLooksOff", () => {
|
43 | 44 | |
44 | 45 | expect(loadModelCatalog).not.toHaveBeenCalled(); |
45 | 46 | expect(ensureAuthProfileStore).toHaveBeenCalledOnce(); |
46 | | -expect(listProfilesForProvider).toHaveBeenCalledWith( |
47 | | -expect.objectContaining({ profiles: {} }), |
48 | | -"openai-codex", |
49 | | -); |
| 47 | +expect(listProfilesForProvider).toHaveBeenCalledOnce(); |
| 48 | +const [profileStore, providerId] = listProfilesForProvider.mock.calls[0] as unknown as [ |
| 49 | +AuthProfileStore, |
| 50 | +string, |
| 51 | +]; |
| 52 | +expect(profileStore?.profiles).toEqual({}); |
| 53 | +expect(providerId).toBe("openai-codex"); |
50 | 54 | expect(note).toHaveBeenCalledWith( |
51 | 55 | expect.stringContaining('No auth configured for provider "openai-codex"'), |
52 | 56 | "Model check", |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
| 2 | +import type { resolvePluginProviders as resolvePluginProvidersFn } from "../plugins/providers.runtime.js"; |
| 3 | + |
| 4 | +type ResolvePluginProvidersOptions = Parameters<typeof resolvePluginProvidersFn>[0]; |
2 | 5 | |
3 | 6 | const resolveManifestProviderAuthChoice = vi.hoisted(() => vi.fn()); |
4 | 7 | const resolveManifestDeprecatedProviderAuthChoice = vi.hoisted(() => vi.fn()); |
@@ -121,11 +124,11 @@ describe("resolvePreferredProviderForAuthChoice", () => {
|
121 | 124 | includeUntrustedWorkspacePlugins: false, |
122 | 125 | }), |
123 | 126 | ).resolves.toBe("demo-provider"); |
124 | | -expect(resolvePluginProviders).toHaveBeenCalledWith( |
125 | | - expect.objectContaining({ |
126 | | - mode: "setup", |
127 | | - includeUntrustedWorkspacePlugins: false, |
128 | | - }), |
129 | | -); |
| 127 | +expect(resolvePluginProviders).toHaveBeenCalledOnce(); |
| 128 | +const [pluginProviderOptions] = resolvePluginProviders.mock.calls[0] as unknown as [ |
| 129 | +ResolvePluginProvidersOptions, |
| 130 | +]; |
| 131 | +expect(pluginProviderOptions?.mode).toBe("setup"); |
| 132 | +expect(pluginProviderOptions?.includeUntrustedWorkspacePlugins).toBe(false); |
130 | 133 | }); |
131 | 134 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。