Skip to content

Commit 2ca4e45

Browse files
committed
tests
1 parent 1956418 commit 2ca4e45

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

src/app/[locale]/account/profile/cohort-discovery-request/components/NhsSdeAccessStepper/NhsSdeAccessStepper.test.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,48 @@ describe("NhsSdeAccessStepper", () => {
211211

212212
expect(screen.getByText("Approved")).toBeInTheDocument();
213213
});
214+
215+
it("shows a capitalised badge and no active-step actions when the NHS request is rejected", () => {
216+
mockUseCohortStatus.mockReturnValue({
217+
...baseStatus,
218+
requestStatus: "APPROVED",
219+
nhseSdeRequestStatus: "REJECTED",
220+
});
221+
222+
renderStepper();
223+
224+
expect(screen.getByText("Rejected")).toBeInTheDocument();
225+
expect(
226+
screen.queryByRole("button", {
227+
name: "Open NHS SDE Registration Form",
228+
})
229+
).not.toBeInTheDocument();
230+
expect(
231+
screen.queryByRole("button", {
232+
name: "I confirm I have been approved by the NHS Research SDE",
233+
})
234+
).not.toBeInTheDocument();
235+
});
236+
237+
it("reveals step 2 with the registration form once the user opts in from step 1", async () => {
238+
mockUseCohortStatus.mockReturnValue({
239+
...baseStatus,
240+
requestStatus: "APPROVED",
241+
});
242+
243+
renderStepper();
244+
245+
await userEvent.click(
246+
screen.getByRole("button", {
247+
name: "Apply for NHS Research SDE Cohort Data Access",
248+
})
249+
);
250+
251+
expect(screen.getByText("Awaiting Action")).toBeInTheDocument();
252+
expect(
253+
screen.getByRole("button", {
254+
name: "Open NHS SDE Registration Form",
255+
})
256+
).toBeInTheDocument();
257+
});
214258
});

0 commit comments

Comments
 (0)