Add resumable admin deep search

This commit is contained in:
Jonathan Sykes
2026-10-14 01:47:35 +08:00
parent ca10fe6486
commit 58d0e6f140
12 changed files with 600 additions and 22 deletions

View File

@@ -1,8 +1,13 @@
import { test, expect } from 'bun:test';
import * as sc from './search-cache.js';
import { initDb } from './db.js';
import { test, expect, afterAll } from 'bun:test';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
const root = mkdtempSync(join(tmpdir(), 'ytp-search-cache-'));
process.env.DB_PATH = join(root, 'test.db');
const sc = await import('./search-cache.js');
const { initDb } = await import('./db.js');
await initDb();
afterAll(() => rmSync(root, { recursive: true, force: true }));
const cards = (n) => Array.from({ length: n }, (_, i) => ({ id: 'v' + i, title: 't' + i }));
test('put/get round-trips, case-insensitive, capped at 200', async () => {