diff --git a/test/helpers/integration-harness.ts b/test/helpers/integration-harness.ts index 9a9a323..58c1d5c 100644 --- a/test/helpers/integration-harness.ts +++ b/test/helpers/integration-harness.ts @@ -174,11 +174,11 @@ export async function dbClose(): Promise { export async function setupFixtures(dbUrl: string, userId: string, kbId: string, kiId: string, sessionId: string): Promise { await dbExec(dbUrl, `INSERT IGNORE INTO User (id, email, nickname, role, status, updatedAt) VALUES (?, ?, ?, ?, ?, NOW())`, [userId, `test-${Date.now()}@zhixi.app`, 'Integration Test', 'USER', 'active']); - await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeBase (id, userId, title) VALUES (?, ?, ?)`, + await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeBase (id, userId, title, updatedAt) VALUES (?, ?, ?, NOW())`, [kbId, userId, 'Test KB']); - await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status) VALUES (?, ?, ?, ?, ?, ?, ?)`, + await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status, updatedAt) VALUES (?, ?, ?, ?, ?, ?, ?, NOW())`, [kiId, userId, kbId, 'concept', 'Test Item', 'Test content.', 'active']); - await dbExec(dbUrl, `INSERT IGNORE INTO LearningSession (id, userId, knowledgeBaseId, knowledgeItemId, mode, status, startedAt) VALUES (?, ?, ?, ?, ?, ?, NOW())`, + await dbExec(dbUrl, `INSERT IGNORE INTO LearningSession (id, userId, knowledgeBaseId, knowledgeItemId, mode, status, startedAt, updatedAt) VALUES (?, ?, ?, ?, ?, ?, NOW(), NOW())`, [sessionId, userId, kbId, kiId, 'active_recall', 'active']); } diff --git a/test/m-ai-01-09.worker-int-spec.ts b/test/m-ai-01-09.worker-int-spec.ts index 86798f2..371d674 100644 --- a/test/m-ai-01-09.worker-int-spec.ts +++ b/test/m-ai-01-09.worker-int-spec.ts @@ -99,8 +99,8 @@ describe('M-AI-01-09 真实集成测试', () => { it('通过 API 入队 AI 分析任务', async () => { // Create an AiAnalysisJob via the repository await dbExec(DB_URL, - `INSERT INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt) - VALUES (?, ?, ?, ?, 'pending', NOW())`, + `INSERT INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt) + VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`, [`ar-job-1`, TEST_USER, 'active-recall', TEST_SESSION]); jobId = 'ar-job-1'; @@ -165,8 +165,8 @@ describe('M-AI-01-09 真实集成测试', () => { const beforeCnt = Number((before[0] as any).cnt); await dbExec(DB_URL, - `INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt) - VALUES (?, ?, ?, ?, 'pending', NOW())`, + `INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt) + VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`, [`ar-dup-1`, TEST_USER, 'active-recall', TEST_SESSION]); await new Promise(r => setTimeout(r, 8000)); @@ -182,8 +182,8 @@ describe('M-AI-01-09 真实集成测试', () => { describe('Document Import', () => { it('创建 KnowledgeItem', async () => { await dbExec(DB_URL, - `INSERT INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status) - VALUES (?, ?, ?, ?, ?, ?, ?)`, + `INSERT INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status, updatedAt) + VALUES (?, ?, ?, ?, ?, ?, ?, NOW())`, [`ki-import-1`, TEST_USER, TEST_KB, 'concept', 'Import Test', '# Test\n\nHello world', 'active']); const rows = await dbQuery(DB_URL, 'SELECT id FROM KnowledgeItem WHERE id = ?', ['ki-import-1']); @@ -226,8 +226,8 @@ describe('M-AI-01-09 真实集成测试', () => { 'SELECT COUNT(*) as cnt FROM AiAnalysisResult WHERE userId = ?', [TEST_USER]); await dbExec(DB_URL, - `INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt) - VALUES (?, ?, ?, ?, 'pending', NOW())`, + `INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt) + VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`, [`ar-500-test`, TEST_USER, 'feynman-evaluation', TEST_SESSION]); await new Promise(r => setTimeout(r, 10_000)); @@ -243,8 +243,8 @@ describe('M-AI-01-09 真实集成测试', () => { mockAI.setInvalidJson(); await dbExec(DB_URL, - `INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt) - VALUES (?, ?, ?, ?, 'pending', NOW())`, + `INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt) + VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`, [`ar-badjson-test`, TEST_USER, 'active-recall', TEST_SESSION]); await new Promise(r => setTimeout(r, 10_000));