Files
pleno-vue/tests/unit/department-overview-period-sync.spec.js
T
Jeppe Bundgaard 29c6c9d135 Add e2e tests for admin module functionalities:
- Introduced tests for admin daily report features, including tile rendering, complaint management, and stale response handling.
- Added department visibility tests to ensure hidden departments are excluded from UI controls.
- Implemented night wash overview tests for breakdown validation, missing hours detection, and stable range updates.
2026-04-08 19:00:24 +02:00

41 lines
1.7 KiB
JavaScript

import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
const root = process.cwd();
const overviewNavigationSource = readFileSync(
join(root, "src/views/dashboards/departmentDashboard/other/displays/DepartmentDashboardOverviewNavigation.vue"),
"utf8"
);
const weeklyOverviewSource = readFileSync(
join(root, "src/views/dashboards/departmentDashboard/other/displays/DepartmentDailyReportThisWeek.vue"),
"utf8"
);
const compactOverviewSource = readFileSync(
join(root, "src/views/dashboards/departmentDashboard/other/displays/DepartmentDailyReportSmall.vue"),
"utf8"
);
describe("Department overview period sync", () => {
it("routes overview date updates through the shared daily report date store", () => {
expect(overviewNavigationSource).toContain("selectDate as selectDailyReportDate");
expect(overviewNavigationSource).toContain("selectDailyReportDate(startIso, endIso);");
expect(overviewNavigationSource).not.toContain(
'import { selected_date, selected_date_to } from "@/views/dashboards/departmentDashboard/other/displays/DepartmentsOverviewObject.vue";'
);
});
it("uses the same selected period refs in both list-mode summary components", () => {
const sharedStoreImport =
'"@/views/dashboards/departmentDashboard/modules/daily-report/DepartmentDailyReportObject.vue"';
expect(weeklyOverviewSource).toContain(sharedStoreImport);
expect(weeklyOverviewSource).toContain("selected_date");
expect(weeklyOverviewSource).toContain("selected_date_to");
expect(compactOverviewSource).toContain(sharedStoreImport);
expect(compactOverviewSource).toContain("selected_date");
expect(compactOverviewSource).toContain("selected_date_to");
});
});