Files
9router/tests/unit/searxng-provider-config.test.js
luulam 7e45ead2ac Merge remote-tracking branch 'origin/master' into gitea/feature/end
Resolved conflicts taking origin/master (v0.5.55) as canonical, with local
features re-applied:
- runtime log level (LOG_LEVEL env + dashboard Settings → Logging, applied
  immediately and persisted across restarts)
- free/noAuth provider enable/disable toggle via providerStrategies.enabled
- parallel model testing (Test All Models / Test Selected Keys)
2026-08-17 00:38:31 +07:00

31 lines
1.0 KiB
JavaScript

import { afterEach, describe, expect, it, vi } from "vitest";
const originalSearxngUrl = process.env.SEARXNG_URL;
async function loadProvider(url) {
if (url === undefined) delete process.env.SEARXNG_URL;
else process.env.SEARXNG_URL = url;
vi.resetModules();
return (await import("../../open-sse/providers/registry/searxng.js")).default;
}
afterEach(() => {
if (originalSearxngUrl === undefined) delete process.env.SEARXNG_URL;
else process.env.SEARXNG_URL = originalSearxngUrl;
vi.resetModules();
});
describe("SearXNG provider configuration", () => {
it("uses SEARXNG_URL when the deployment config supplies one", async () => {
const provider = await loadProvider("http://searxng:8080/search");
expect(provider.searchConfig.baseUrl).toBe("http://searxng:8080/search");
});
it("preserves the loopback default when SEARXNG_URL is unset", async () => {
const provider = await loadProvider(undefined);
expect(provider.searchConfig.baseUrl).toBe("http://localhost:8888/search");
});
});