Add unit tests for shared date range synchronization and refactor DepartmentDashboardOverviewNavigation components:

- Added behavior tests covering shared date range updates across multiple components, including `DepartmentDailyReportThisWeek` and `DepartmentDailyReportSmall`.
- Updated `DepartmentDashboardOverviewNavigation` to route date updates via the shared daily report store.
- Refactored components to use shared `DepartmentDailyReportObject` for date state management.
- Adjusted e2e tests to validate date range synchronization and department goal progress tracking.
This commit is contained in:
Jeppe Bundgaard
2026-03-24 16:53:16 +01:00
parent 477688d16e
commit 1b97332c38
11 changed files with 431 additions and 29 deletions
+10 -10
View File
@@ -333,8 +333,8 @@ test.describe('Admin Module - Goals', () => {
label: 'Cadence Biweekly Goal',
type: 'PRODUCT',
target: 7,
start: '2026-01-01T00:00:00+01:00',
end: '2026-12-31T23:59:59+01:00',
start: '2026-03-24T00:00:00+01:00',
end: '2026-07-24T23:59:59+01:00',
products: [1],
users: [],
departments: [departmentId],
@@ -350,8 +350,8 @@ test.describe('Admin Module - Goals', () => {
target_duration_every: 2,
},
progress: {
all: { count: 11, target: 189, date_from: '2026-01-01T00:00:00+01:00', date_end: '2026-12-31T23:59:59+01:00' },
to_date: { count: 6, target: 42, date_from: '2026-01-01T00:00:00+01:00', date_end: '2026-03-24T23:59:59+01:00' },
all: { count: 11, target: 63, date_from: '2026-03-24T00:00:00+01:00', date_end: '2026-07-24T23:59:59+01:00' },
to_date: { count: 6, target: 7, date_from: '2026-03-24T00:00:00+01:00', date_end: '2026-03-24T23:59:59+01:00' },
today: { count: 1, target: 2, date_from: '2026-04-04T00:00:00+01:00', date_end: '2026-04-04T23:59:59+01:00' },
week: { count: 4, target: 7, date_from: '2026-03-23T00:00:00+01:00', date_end: '2026-03-29T23:59:59+01:00' },
month: { count: 9, date_from: '2026-04-01T00:00:00+01:00', date_end: '2026-04-30T23:59:59+01:00' },
@@ -359,8 +359,8 @@ test.describe('Admin Module - Goals', () => {
every_2_weeks: { count: 5, target: 14, date_from: '2026-03-12T00:00:00+01:00', date_end: '2026-03-25T23:59:59+01:00' },
departmental_distribution: {
[String(departmentId)]: {
all: { count: 11, target: 189 },
to_date: { count: 6, target: 42 },
all: { count: 11, target: 63 },
to_date: { count: 6, target: 7 },
today: { count: 1, target: 2 },
week: { count: 4, target: 7 },
month: { count: 9 },
@@ -402,11 +402,11 @@ test.describe('Admin Module - Goals', () => {
await expect(progressBar).toHaveAttribute('max', new RegExp(`^${max}(?:\\.0+)?$`));
};
await expectProgress(11, 189);
await expectProgress(11, 63);
await timeframeTabs.locator('li').nth(1).click(); // Indtil nu
await expect(timeframeTabs.locator('li').nth(1)).toHaveClass(/is-active/);
await expectProgress(6, 42);
await expectProgress(6, 7);
await timeframeTabs.locator('li').nth(2).click(); // I dag
await expect(timeframeTabs.locator('li').nth(2)).toHaveClass(/is-active/);
@@ -418,11 +418,11 @@ test.describe('Admin Module - Goals', () => {
await timeframeTabs.locator('li').nth(4).click(); // Denne måned
await expect(timeframeTabs.locator('li').nth(4)).toHaveClass(/is-active/);
await expectProgress(9, 21);
await expectProgress(9, 7);
await timeframeTabs.locator('li').nth(5).click(); // År
await expect(timeframeTabs.locator('li').nth(5)).toHaveClass(/is-active/);
await expectProgress(20, 189);
await expectProgress(20, 63);
});
test('opens create goal modal and supports cancel', async ({ page }) => {