From d57d9e009e2a4c7a99638a96793be5f746cbc6d6 Mon Sep 17 00:00:00 2001 From: wangdl Date: Fri, 19 Jun 2026 22:39:52 +0800 Subject: [PATCH] fix: explicit JWT_SECRET in process env + correct 404 test --- test/helpers/integration-harness.ts | 4 +++- test/m-ai-01-09-api-e2e.worker-int-spec.ts | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/helpers/integration-harness.ts b/test/helpers/integration-harness.ts index af0070e..98addbe 100644 --- a/test/helpers/integration-harness.ts +++ b/test/helpers/integration-harness.ts @@ -101,7 +101,9 @@ function envForProcess(baseEnv: NodeJS.ProcessEnv): NodeJS.ProcessEnv { DEEPSEEK_API_KEY: 'sk-test', STORAGE_DRIVER: 'local', ENABLE_SWAGGER: 'false', - // No Bull Board in test + JWT_SECRET: baseEnv.JWT_SECRET || 'test-integration-secret', + JWT_ACCESS_EXPIRES_IN: '1h', + CREDENTIAL_ENCRYPTION_KEY: baseEnv.CREDENTIAL_ENCRYPTION_KEY || '0123456789abcdef0123456789abcdef', }; } diff --git a/test/m-ai-01-09-api-e2e.worker-int-spec.ts b/test/m-ai-01-09-api-e2e.worker-int-spec.ts index b8dbada..aba2f64 100644 --- a/test/m-ai-01-09-api-e2e.worker-int-spec.ts +++ b/test/m-ai-01-09-api-e2e.worker-int-spec.ts @@ -232,11 +232,12 @@ describe('API E2E: Active Recall', () => { expect(res.status).toBe(401); }); - it('404 不存在的 Question', async () => { + it('不存在的 Question 返回 404', async () => { const res = await httpPost('/api/active-recalls/nonexistent-id/submit', { answerText: 'A', }, userToken); - expect([403, 404]).toContain(res.status); + // Service throws NotFoundException → 404 + expect(res.status).toBe(404); }); });