test: fix broken suites

This commit is contained in:
Linus Rath
2026-07-22 18:56:09 +02:00
parent 3f22a3323a
commit 813185e58d
6 changed files with 30 additions and 10 deletions
+10 -1
View File
@@ -1,6 +1,15 @@
import { unlink, writeFileSync } from "fs";
import { mkdtempSync, unlink, writeFileSync } from "fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
// The route consults admin-dashboard overrides (ADMIN_CONFIG_DIR, default
// data/admin) before env vars. Point it at an empty temp dir so local admin
// state on the developer's machine can't leak into these env-driven
// assertions. Must happen before the first GET, because the config manager
// singleton loads the directory once and caches it.
process.env.ADMIN_CONFIG_DIR = mkdtempSync(path.join(tmpdir(), 'bw-config-route-'));
// Mock NextResponse before importing the route
vi.mock('next/server', () => ({
NextResponse: {