Skip to content

Commit

Permalink
Add test for blocked pas
Browse files Browse the repository at this point in the history
  • Loading branch information
RoanPaulus committed Jan 16, 2025
1 parent 3c35207 commit dec90e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/client/pages/HLI/HLIStadspas.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { AppRoutes } from '../../../universal/config/routes';
const createStadspas = stadspasCreator();
const passNumber = 12345678;

const testState = {
const activePasState = {
HLI: {
status: 'OK',
content: {
Expand All @@ -20,16 +20,32 @@ const testState = {
},
} as unknown as AppState;

const pasBlockedState = {
HLI: {
status: 'OK',
content: {
regelingen: [],
stadspas: [createStadspas('Lou', false, passNumber)],
},
},
} as unknown as AppState;

const createHLIStadspasComponent = componentCreator({
component: HLIStadspas,
routePath: AppRoutes['HLI/STADSPAS'],
routeEntry: generatePath(AppRoutes['HLI/STADSPAS'], { passNumber }),
});

describe('<HLIStadspas />', () => {
it('Finds the block button', () => {
const HLIStadspas = createHLIStadspasComponent(testState);
test('Finds the block button', () => {
const HLIStadspas = createHLIStadspasComponent(activePasState);
const screen = render(<HLIStadspas />);
expect(screen.getByTestId('block-stadspas-button')).toBeInTheDocument();
});

test('Find label communicating that the stadspas is blocked', () => {
const HLIStadspas = createHLIStadspasComponent(pasBlockedState);
const screen = render(<HLIStadspas />);
expect(screen.getByTestId('stadspas-blocked-alert')).toBeInTheDocument();
});
});
1 change: 1 addition & 0 deletions src/client/pages/HLI/HLIStadspas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ function PassBlockedAlert() {
<Alert
heading="Deze pas is geblokkeerd, hoe vraag ik een nieuwe aan?"
severity="warning"
data-testid="stadspas-blocked-alert"
>
<Paragraph>
Wilt u uw pas deblokkeren of wilt u een nieuwe pas aanvragen? Bel dan
Expand Down

0 comments on commit dec90e0

Please sign in to comment.