test(api): close the DB and remove the temp DATA_DIR after the search alias tests

This commit is contained in:
Rafa Martins
2026-11-18 22:06:33 -03:00
committed by diegosouzapw
parent 7fac3cc2ba
commit 3a7cabbb3a

View File

@@ -3,6 +3,7 @@ import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { cleanupTempDataDir } from "../_setup/tempDataDir.ts";
const TEST_DATA_DIR = fs.mkdtempSync(
path.join(os.tmpdir(), "omniroute-search-blocked-alias-20276-test-")
@@ -13,6 +14,8 @@ process.env.API_KEY_SECRET = process.env.API_KEY_SECRET || "search-blocked-alias
const { updateSettings } = await import("../../src/lib/db/settings.ts");
const { POST } = await import("../../src/app/api/v1/search/route.ts");
test.after(() => cleanupTempDataDir(TEST_DATA_DIR));
test("POST /v1/search rejects blocked search provider requested via alias (kimi-search via moonshot) with 403 (#20276)", async () => {
await updateSettings({ blockedProviders: ["kimi-search"] });