Skip to content

Commit

Permalink
adds redirect to process end and fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cammiida committed Dec 4, 2024
1 parent e5b0a43 commit 19ecb4a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ export const App = () => (
path={TaskKeys.ProcessEnd}
element={<DefaultReceipt />}
/>
<Route
path={TaskKeys.CustomReceipt}
element={<CustomReceipt />}
/>
<Route path={TaskKeys.CustomReceipt}>
<Route
path='*'
element={<CustomReceipt />}
/>
</Route>
<Route
index
element={<NavigateToStartUrl />}
Expand Down
5 changes: 5 additions & 0 deletions src/components/wrappers/ProcessWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ export const ProcessWrapper = () => {
const isValidTaskId = useIsValidTaskId();
const taskIdParam = useNavigationParam('taskId');
const taskType = useGetTaskTypeById()(taskIdParam);
const process = useLaxProcessData();

if (process?.ended) {
return <NavigateToStartUrl />;
}

if (!isValidTaskId(taskIdParam)) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/features/receipt/ReceiptContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('ReceiptContainer', () => {

expect(
screen.getByRole('heading', {
name: 'Skjema er sendt inn',
name: 'Skjemaet er sendt inn',
}),
).toBeInTheDocument();

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/integration/frontend-test/custom-confirm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ describe('Custom confirm page', () => {
cy.get('[data-componentid="confirmBody"]').should('contain.text', `på forrige side valgte du Petter.`);
cy.findByRole('button', { name: /send inn/i }).click();

cy.get('#ReceiptContainer').should('contain.text', 'Skjema er sendt inn');
cy.get('#ReceiptContainer').should('contain.text', 'Skjemaet er sendt inn');
});
});

0 comments on commit 19ecb4a

Please sign in to comment.