import type { Meta, StoryObj } from '@storybook/angular'; import { applicationConfig } from '@storybook/angular'; import { MijnRegistratieSection } from './mijn-registratie.section'; import { BigProfileStore } from '@registratie/application/big-profile.store'; import { BigProfile } from '@registratie/domain/big-profile'; import { RemoteData } from '@shared/application/remote-data'; import { loading, success, failure } from '@shared/testing/remote-data'; const profile: BigProfile = { registration: { bigNummer: '19012345601', naam: 'Dr. A. (Anna) de Vries', beroep: 'Arts', registratiedatum: '2012-09-01', geboortedatum: '1985-03-14', status: { tag: 'Geregistreerd', herregistratieDatum: '2027-09-01' }, }, person: { naam: 'Dr. A. (Anna) de Vries', geboortedatum: '1985-03-14', adres: { straat: 'Rijksweg 1', postcode: '2514 EA', woonplaats: 'Den Haag' }, }, }; /** Minimal store stand-in — only the members the section's template reads. */ function storeStub(profileRd: RemoteData) { return { profile: () => profileRd, reloadProfile: () => {} }; } const meta: Meta = { title: 'Domein/Registratie/Mijn Registratie', component: MijnRegistratieSection, }; export default meta; type Story = StoryObj; export const Loading: Story = { decorators: [ applicationConfig({ providers: [{ provide: BigProfileStore, useValue: storeStub(loading()) }], }), ], }; export const Loaded: Story = { decorators: [ applicationConfig({ providers: [{ provide: BigProfileStore, useValue: storeStub(success(profile)) }], }), ], }; export const Failed: Story = { decorators: [ applicationConfig({ providers: [{ provide: BigProfileStore, useValue: storeStub(failure(new Error('offline'))) }], }), ], };