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

@@ -95,7 +95,7 @@ export function registerItemTools(db: Db) {
return {
list_items: async (args: { categoryId?: number }): Promise<ToolResult> => {
try {
const items = getAllItems(db);
const items = await getAllItems(db);
if (args.categoryId) {
return textResult(
items.filter((i) => i.categoryId === args.categoryId),
@@ -109,7 +109,7 @@ export function registerItemTools(db: Db) {
get_item: async (args: { id: number }): Promise<ToolResult> => {
try {
const item = getItemById(db, args.id);
const item = await getItemById(db, args.id);
if (!item) return errorResult(`Item ${args.id} not found`);
return textResult(item);
} catch (err) {
@@ -128,7 +128,7 @@ export function registerItemTools(db: Db) {
imageSourceUrl?: string;
}): Promise<ToolResult> => {
try {
const item = createItem(db, args);
const item = await createItem(db, args);
return textResult(item);
} catch (err) {
return errorResult((err as Error).message);
@@ -148,7 +148,7 @@ export function registerItemTools(db: Db) {
}): Promise<ToolResult> => {
try {
const { id, ...data } = args;
const item = updateItem(db, id, data);
const item = await updateItem(db, id, data);
if (!item) return errorResult(`Item ${id} not found`);
return textResult(item);
} catch (err) {
@@ -158,7 +158,7 @@ export function registerItemTools(db: Db) {
delete_item: async (args: { id: number }): Promise<ToolResult> => {
try {
const item = deleteItem(db, args.id);
const item = await deleteItem(db, args.id);
if (!item) return errorResult(`Item ${args.id} not found`);
return textResult({ deleted: true, item });
} catch (err) {