refactor: split dashboard.page.ts into per-concern sections
Each dashboard section (Mijn aanvragen, Wat moet ik regelen, Mijn registratie, Specialismen, Wat wilt u doen, Beheer) now owns its own store access, async state, and template. DashboardPage becomes pure composition. Extract the repeated RemoteData Success-narrowing pattern into successOf() and the dashboard sort/split logic into sortForDashboard/concepten/ingediend, both with tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { RemoteData, map2, map } from './remote-data';
|
||||
import { loading, failure, success } from '../testing/remote-data';
|
||||
import { RemoteData, map2, map, successOf } from './remote-data';
|
||||
import { loading, failure, empty, success } from '../testing/remote-data';
|
||||
|
||||
const loadingRd: RemoteData<string, number> = loading();
|
||||
const failureRd: RemoteData<string, number> = failure('x');
|
||||
@@ -21,3 +21,15 @@ describe('RemoteData combinators', () => {
|
||||
expect(map2(ok(2), ok(3), add)).toEqual({ tag: 'Success', value: 5 });
|
||||
});
|
||||
});
|
||||
|
||||
describe('successOf', () => {
|
||||
it('unwraps a Success value', () => {
|
||||
expect(successOf(ok(2))).toBe(2);
|
||||
});
|
||||
|
||||
it('is undefined for every other state', () => {
|
||||
expect(successOf(loadingRd)).toBeUndefined();
|
||||
expect(successOf(failureRd)).toBeUndefined();
|
||||
expect(successOf(empty())).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user