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:
@@ -119,7 +119,7 @@ export function registerThreadTools(db: Db) {
|
||||
includeResolved?: boolean;
|
||||
}): Promise<ToolResult> => {
|
||||
try {
|
||||
const threadList = getAllThreads(db, args.includeResolved ?? false);
|
||||
const threadList = await getAllThreads(db, args.includeResolved ?? false);
|
||||
return textResult(threadList);
|
||||
} catch (err) {
|
||||
return errorResult((err as Error).message);
|
||||
@@ -128,7 +128,7 @@ export function registerThreadTools(db: Db) {
|
||||
|
||||
get_thread: async (args: { id: number }): Promise<ToolResult> => {
|
||||
try {
|
||||
const thread = getThreadWithCandidates(db, args.id);
|
||||
const thread = await getThreadWithCandidates(db, args.id);
|
||||
if (!thread) return errorResult(`Thread ${args.id} not found`);
|
||||
return textResult(thread);
|
||||
} catch (err) {
|
||||
@@ -141,7 +141,7 @@ export function registerThreadTools(db: Db) {
|
||||
categoryId: number;
|
||||
}): Promise<ToolResult> => {
|
||||
try {
|
||||
const thread = createThread(db, args);
|
||||
const thread = await createThread(db, args);
|
||||
return textResult(thread);
|
||||
} catch (err) {
|
||||
return errorResult((err as Error).message);
|
||||
@@ -153,7 +153,7 @@ export function registerThreadTools(db: Db) {
|
||||
candidateId: number;
|
||||
}): Promise<ToolResult> => {
|
||||
try {
|
||||
const result = resolveThread(db, args.threadId, args.candidateId);
|
||||
const result = await resolveThread(db, args.threadId, args.candidateId);
|
||||
if (!result.success) {
|
||||
return errorResult(result.error ?? "Failed to resolve thread");
|
||||
}
|
||||
@@ -177,7 +177,7 @@ export function registerThreadTools(db: Db) {
|
||||
}): Promise<ToolResult> => {
|
||||
try {
|
||||
const { threadId, ...data } = args;
|
||||
const candidate = createCandidate(db, threadId, data);
|
||||
const candidate = await createCandidate(db, threadId, data);
|
||||
return textResult(candidate);
|
||||
} catch (err) {
|
||||
return errorResult((err as Error).message);
|
||||
@@ -200,7 +200,7 @@ export function registerThreadTools(db: Db) {
|
||||
}): Promise<ToolResult> => {
|
||||
try {
|
||||
const { id, ...data } = args;
|
||||
const candidate = updateCandidate(db, id, data);
|
||||
const candidate = await updateCandidate(db, id, data);
|
||||
if (!candidate) return errorResult(`Candidate ${id} not found`);
|
||||
return textResult(candidate);
|
||||
} catch (err) {
|
||||
@@ -210,7 +210,7 @@ export function registerThreadTools(db: Db) {
|
||||
|
||||
remove_candidate: async (args: { id: number }): Promise<ToolResult> => {
|
||||
try {
|
||||
const candidate = deleteCandidate(db, args.id);
|
||||
const candidate = await deleteCandidate(db, args.id);
|
||||
if (!candidate) return errorResult(`Candidate ${args.id} not found`);
|
||||
return textResult({ deleted: true, candidate });
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user