test: add analysisOnly regression tests; fix cache isolation in tests
New file tests/experimentDailyStatuses.test.js — 9 tests covering GET /api/experiments/:id/daily-statuses: - 404 on unknown experiment - all statuses returned when no filter - analysisOnly=true keeps only non-null analysis_summary records - analysisOnly=true returns [] when none have analysis_summary - the exact null/object mix that caused the production 500 now passes - analysisOnly=false (explicit) returns all records - ?date= param is forwarded to Prisma correctly - empty-array response on zero statuses - returned records include expected fields Fixed tests/calendar.test.js: existing tests were silently broken by the cache added in the perf commit. Both test files now mock lib/cache to always miss, so each test exercises the real route logic in isolation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
const request = require('supertest');
|
||||
|
||||
jest.mock('../src/lib/prisma', () => require('./__mocks__/prisma'));
|
||||
jest.mock('../src/lib/cache', () => ({ get: jest.fn(() => undefined), set: jest.fn(), del: jest.fn(), delByPrefix: jest.fn() }));
|
||||
|
||||
const prisma = require('../src/lib/prisma');
|
||||
const app = require('../src/app');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user