test: fix setup finalize web search mocks (#51253)
This commit is contained in:
parent
1b18742e8e
commit
23fef04c4e
@ -154,6 +154,21 @@ function createRuntime(): RuntimeEnv {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createWebSearchProviderEntry(
|
||||||
|
provider: Pick<
|
||||||
|
PluginWebSearchProviderEntry,
|
||||||
|
"id" | "label" | "hint" | "envVars" | "placeholder" | "signupUrl" | "credentialPath"
|
||||||
|
>,
|
||||||
|
): PluginWebSearchProviderEntry {
|
||||||
|
return {
|
||||||
|
pluginId: `plugin-${provider.id}`,
|
||||||
|
getCredentialValue: () => undefined,
|
||||||
|
setCredentialValue: () => {},
|
||||||
|
createTool: () => null,
|
||||||
|
...provider,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function expectFirstOnboardingInstallPlanCallOmitsToken() {
|
function expectFirstOnboardingInstallPlanCallOmitsToken() {
|
||||||
const [firstArg] =
|
const [firstArg] =
|
||||||
(buildGatewayInstallPlan.mock.calls.at(0) as [Record<string, unknown>] | undefined) ?? [];
|
(buildGatewayInstallPlan.mock.calls.at(0) as [Record<string, unknown>] | undefined) ?? [];
|
||||||
@ -414,7 +429,7 @@ describe("finalizeSetupWizard", () => {
|
|||||||
|
|
||||||
it("only reports legacy auto-detect for runtime-visible providers", async () => {
|
it("only reports legacy auto-detect for runtime-visible providers", async () => {
|
||||||
listConfiguredWebSearchProviders.mockReturnValue([
|
listConfiguredWebSearchProviders.mockReturnValue([
|
||||||
{
|
createWebSearchProviderEntry({
|
||||||
id: "perplexity",
|
id: "perplexity",
|
||||||
label: "Perplexity Search",
|
label: "Perplexity Search",
|
||||||
hint: "Fast web answers",
|
hint: "Fast web answers",
|
||||||
@ -422,7 +437,7 @@ describe("finalizeSetupWizard", () => {
|
|||||||
placeholder: "pplx-...",
|
placeholder: "pplx-...",
|
||||||
signupUrl: "https://www.perplexity.ai/",
|
signupUrl: "https://www.perplexity.ai/",
|
||||||
credentialPath: "plugins.entries.perplexity.config.webSearch.apiKey",
|
credentialPath: "plugins.entries.perplexity.config.webSearch.apiKey",
|
||||||
},
|
}),
|
||||||
]);
|
]);
|
||||||
hasExistingKey.mockImplementation((_config, provider) => provider === "perplexity");
|
hasExistingKey.mockImplementation((_config, provider) => provider === "perplexity");
|
||||||
|
|
||||||
@ -463,7 +478,7 @@ describe("finalizeSetupWizard", () => {
|
|||||||
|
|
||||||
it("uses configured provider resolution instead of the active runtime registry", async () => {
|
it("uses configured provider resolution instead of the active runtime registry", async () => {
|
||||||
listConfiguredWebSearchProviders.mockReturnValue([
|
listConfiguredWebSearchProviders.mockReturnValue([
|
||||||
{
|
createWebSearchProviderEntry({
|
||||||
id: "firecrawl",
|
id: "firecrawl",
|
||||||
label: "Firecrawl Search",
|
label: "Firecrawl Search",
|
||||||
hint: "Structured results",
|
hint: "Structured results",
|
||||||
@ -471,7 +486,7 @@ describe("finalizeSetupWizard", () => {
|
|||||||
placeholder: "fc-...",
|
placeholder: "fc-...",
|
||||||
signupUrl: "https://www.firecrawl.dev/",
|
signupUrl: "https://www.firecrawl.dev/",
|
||||||
credentialPath: "plugins.entries.firecrawl.config.webSearch.apiKey",
|
credentialPath: "plugins.entries.firecrawl.config.webSearch.apiKey",
|
||||||
},
|
}),
|
||||||
]);
|
]);
|
||||||
hasExistingKey.mockImplementation((_config, provider) => provider === "firecrawl");
|
hasExistingKey.mockImplementation((_config, provider) => provider === "firecrawl");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user