Add dashboard report snapshots feature with CRUD operations. Implemented new database migrations for dashboard_report_snapshots, including report type handling. Updated backend routes and models to support snapshot retrieval and upsert functionality. Enhanced frontend components to integrate report snapshot management, including UI for daily and end-cycle reports. Added tests for new functionality to ensure reliability.
CI / lint-and-test (push) Canceled after 0s

This commit is contained in:
Alberto-Audrix committed 2026-08-13 15:46:16 +07:00
1 parent 059087be1d
commit 34336b9bd1
41 files changed
+4824 -178

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { describe, it, expect } from 'vitest';
import { closedCycleUpToDay, isCycleClosed } from '../reportCycle.ts';
describe('isCycleClosed', () => {
it('is false when endDate is missing', () => {
expect(isCycleClosed(undefined)).toBe(false);
expect(isCycleClosed(null)).toBe(false);
expect(isCycleClosed('')).toBe(false);
});
it('is true when endDate is set', () => {
expect(isCycleClosed('2026-06-25')).toBe(true);
expect(isCycleClosed(new Date('2026-06-25T00:00:00'))).toBe(true);
});
});
describe('closedCycleUpToDay', () => {
it('returns the inclusive report day of endDate', () => {
expect(closedCycleUpToDay('2026-05-22', '2026-05-30')).toBe(8);
});
it('returns 0 when endDate is missing or before start', () => {
expect(closedCycleUpToDay('2026-05-22', null)).toBe(0);
expect(closedCycleUpToDay('2026-05-22', '2026-05-20')).toBe(0);
});
});