feat(14-06): convert route tests + MCP tests to async PGlite

- All 8 route test files: async createTestApp(), async beforeEach
- MCP tools test: await createTestDb(), await getCollectionSummary()
- Fixed MCP tool files: added await to all service calls in items, categories, threads, setups tools
- Fixed MCP collection resource: made getCollectionSummary async
- Fixed MCP index.ts: await getCollectionSummary call
- Increased test timeout to 30s in bunfig.toml for PGlite WASM overhead
- Zero SQLite references remain in tests/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 15:40:14 +02:00
parent 458b33f1c7
commit f30d375544
15 changed files with 80 additions and 79 deletions

View File

@@ -64,7 +64,7 @@ export function registerSetupTools(db: Db) {
return {
list_setups: async (): Promise<ToolResult> => {
try {
const setupList = getAllSetups(db);
const setupList = await getAllSetups(db);
return textResult(setupList);
} catch (err) {
return errorResult((err as Error).message);
@@ -73,7 +73,7 @@ export function registerSetupTools(db: Db) {
get_setup: async (args: { id: number }): Promise<ToolResult> => {
try {
const setup = getSetupWithItems(db, args.id);
const setup = await getSetupWithItems(db, args.id);
if (!setup) return errorResult(`Setup ${args.id} not found`);
return textResult(setup);
} catch (err) {
@@ -83,7 +83,7 @@ export function registerSetupTools(db: Db) {
create_setup: async (args: { name: string }): Promise<ToolResult> => {
try {
const setup = createSetup(db, args);
const setup = await createSetup(db, args);
return textResult(setup);
} catch (err) {
return errorResult((err as Error).message);
@@ -98,14 +98,14 @@ export function registerSetupTools(db: Db) {
try {
let setup = null;
if (args.name) {
setup = updateSetup(db, args.id, { name: args.name });
setup = await updateSetup(db, args.id, { name: args.name });
if (!setup) return errorResult(`Setup ${args.id} not found`);
}
if (args.itemIds) {
syncSetupItems(db, args.id, args.itemIds);
await syncSetupItems(db, args.id, args.itemIds);
}
// Return updated setup with items
const result = getSetupWithItems(db, args.id);
const result = await getSetupWithItems(db, args.id);
if (!result) return errorResult(`Setup ${args.id} not found`);
return textResult(result);
} catch (err) {