fix(tests): stats.test.ts topCategory test broken on Sundays — wrong Monday calculation
This commit is contained in:
parent
3adab843cd
commit
e0c7f24954
@ -3,3 +3,4 @@
|
|||||||
|
|
||||||
# Platform Service (backend API for sync, auth, telemetry)
|
# Platform Service (backend API for sync, auth, telemetry)
|
||||||
NEXT_PUBLIC_PLATFORM_SERVICE_URL=http://localhost:4003/api
|
NEXT_PUBLIC_PLATFORM_SERVICE_URL=http://localhost:4003/api
|
||||||
|
NEXT_PUBLIC_PRODUCT_ID=chronomind
|
||||||
|
|||||||
@ -294,7 +294,9 @@ describe('computeWeeklySummary', () => {
|
|||||||
it('identifies top category', () => {
|
it('identifies top category', () => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const weekStart = new Date(now);
|
const weekStart = new Date(now);
|
||||||
weekStart.setDate(weekStart.getDate() - weekStart.getDay() + 1); // Monday
|
const day = weekStart.getDay(); // 0=Sun
|
||||||
|
const diff = day === 0 ? 6 : day - 1; // match getWeekStart logic
|
||||||
|
weekStart.setDate(weekStart.getDate() - diff); // Monday
|
||||||
weekStart.setHours(12, 0, 0, 0);
|
weekStart.setHours(12, 0, 0, 0);
|
||||||
|
|
||||||
const timers = [
|
const timers = [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user