Add goal progress resolver utility with extensive tests and DepartmentGoals refactor.

- Implemented `goalProgressResolver` utility for resolving progress keys, slices, and periods.
- Refactored `DepartmentGoals` to integrate `goalProgressResolver` for improved clarity and modularity.
- Updated progress calculations with cadence-aware key handling and fallback resolution.
- Add isLoading handling and loader animations to `DepartmentWeather` and improve `GET` request concurrency.
This commit is contained in:
Jeppe Bundgaard
2026-03-24 14:58:48 +01:00
parent 8b8780bbaf
commit 1e6590e2df
6 changed files with 334 additions and 40 deletions
+23
View File
@@ -189,6 +189,29 @@ describe("DepartmentWeather", () => {
expect(getFirstWashesCellText(wrapper)).toBe("9002");
});
it("shows loading state while weather request is in flight", async () => {
const pending = createDeferred();
getObjectsMock.mockImplementationOnce(() => pending.promise);
const wrapper = mount(DepartmentWeather, {
props: {
department_ids: [1],
date_from: "2026-03-24",
date_to: "2026-03-24",
},
});
await nextTick();
expect(wrapper.find(".daily-metrics-loading").exists()).toBe(true);
expect(wrapper.find("table.table").exists()).toBe(false);
pending.resolve([makeEntry({ time: "06:00", washes: 4, hours: 2 })]);
await flushAll();
expect(wrapper.find(".daily-metrics-loading").exists()).toBe(false);
expect(wrapper.find("table.table").exists()).toBe(true);
});
it("hides hour columns when both washes and hours are zero", async () => {
getObjectsMock.mockResolvedValueOnce([
makeEntry({ time: "00:00", washes: 0, hours: 0 }),