Skip to content

Conversation

@lillie-dae
Copy link
Contributor

@lillie-dae lillie-dae commented Jan 28, 2026

Overview

Jira ticket: PRMP-1326

Description

Context

review_jounrey_remove_all.webm

Checklist

Tasks for all changes:

  • 1. I have linked this PR to its Jira ticket.
  • 2. I have run git pre-commits. (WIP)
  • 3. I have added and/or updated relevant tests.
  • 4. I have updated relevant documentation.
  • 5. I have considered the cross-team impact (and have PR approval from both Core & Demographics if necessary).
  • 6. I have successfully deployed this change to a sandbox and witnessed unit and e2e tests passing:

Additional tasks for UI changes (delete if not applicable):

  • 1. I have run the UI Smoke Tests against the deployed sandbox and witnessed it passing:
  • 2. I have added evidence (to this PR) e.g. screenshots/gifs of all visual changes.

@lillie-dae lillie-dae marked this pull request as ready for review January 28, 2026 14:05
@lillie-dae lillie-dae requested review from a team as code owners January 28, 2026 14:05

return (
<>
<BackLink onClick={handleGoBack} data-testid="back-button">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back button component does this by default, should we use it here?

Comment on lines +63 to +116
it('renders the back link with correct text', () => {
render(
<ReviewDetailsDocumentRemoveAllStage
reviewData={mockReviewData}
documents={mockDocuments}
setDocuments={mockSetDocuments}
/>,
);

expect(screen.getByTestId('back-button')).toBeInTheDocument();
expect(screen.getByText('Go back')).toBeInTheDocument();
});

it('renders DocumentUploadRemoveFilesStage component', () => {
render(
<ReviewDetailsDocumentRemoveAllStage
reviewData={mockReviewData}
documents={mockDocuments}
setDocuments={mockSetDocuments}
/>,
);

expect(
screen.getByRole('heading', {
name: 'Are you sure you want to remove all selected files?',
}),
).toBeInTheDocument();
});

it('renders remove files button', () => {
render(
<ReviewDetailsDocumentRemoveAllStage
reviewData={mockReviewData}
documents={mockDocuments}
setDocuments={mockSetDocuments}
/>,
);

expect(
screen.getByRole('button', { name: 'Yes, remove all files' }),
).toBeInTheDocument();
});

it('renders cancel button', () => {
render(
<ReviewDetailsDocumentRemoveAllStage
reviewData={mockReviewData}
documents={mockDocuments}
setDocuments={mockSetDocuments}
/>,
);

expect(screen.getByRole('button', { name: 'Cancel' })).toBeInTheDocument();
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like this could be one test?

documents={mockDocuments}
setDocuments={mockSetDocuments}
/>,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the "renderApp" pattern that we use in other tests please

</div>
</div>
)),
default: vi.fn(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do these tests without mocking this component? Given that these components are a wrapper around the upload ones, we should probably test that it works when using the actual base component.

expect(dashCell).toBeInTheDocument();
});

it('allows removing additional documents but not review documents', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to check that a button for trying to remove review doc doesn't exist?

Comment on lines +63 to +103
it('renders the confirmation page with correct title', async () => {
render(
<DocumentUploadRemoveFilesStage
documents={documents}
setDocuments={() => {}}
setDocuments={mockSetDocuments}
documentType={DOCUMENT_TYPE.LLOYD_GEORGE}
/>,
);

await waitFor(async () => {
await waitFor(() => {
expect(
screen.getByText('Are you sure you want to remove all selected files?'),
).toBeInTheDocument();
});
});

it('renders remove files button', () => {
render(
<DocumentUploadRemoveFilesStage
documents={documents}
setDocuments={mockSetDocuments}
documentType={DOCUMENT_TYPE.LLOYD_GEORGE}
/>,
);

expect(screen.getByTestId('remove-files-button')).toBeInTheDocument();
expect(screen.getByText('Yes, remove all files')).toBeInTheDocument();
});

it('renders cancel button', () => {
render(
<DocumentUploadRemoveFilesStage
documents={documents}
setDocuments={mockSetDocuments}
documentType={DOCUMENT_TYPE.LLOYD_GEORGE}
/>,
);

expect(screen.getByText('Cancel')).toBeInTheDocument();
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be one test?

@github-actions
Copy link

Code security issues found

View full details here.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants