Skip to content

Commit

Permalink
chore: updating tests for next rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
gurjmatharu committed Mar 15, 2023
1 parent 959be25 commit 8720ab1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FormIndexPageQuery } from "__generated__/FormIndexPageQuery.graphql";
const defaultMockResolver = {
ProjectRevision(context, generateId) {
return {
id: `mock-proj-rev-${generateId()}`,
id: `mock-id`,
projectId: 123,
changeStatus: "pending",
projectByProjectId: {
Expand All @@ -29,7 +29,18 @@ const defaultMockResolver = {
},
},
managerFormChanges: {
edges: [],
edges: [
{
node: {
projectManagerLabel: {
id: "Test Label 1 ID",
rowId: 1,
label: "Test Label 1",
},
formChange: null,
},
},
],
},
milestoneReportStatuses: {
edges: [],
Expand Down Expand Up @@ -86,4 +97,15 @@ describe("The Project Overview Page (external)", () => {
).getByText(/Declaration/i)
).toBeInTheDocument();
});

it("renders the next button", () => {
externalPageTestingHelper.loadQuery();
externalPageTestingHelper.renderPage();
screen.logTestingPlaygroundURL();
expect(
screen.getByRole("button", {
name: /next/i,
})
).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,15 @@ describe("The Project Annual Reports page", () => {
expect(container.childElementCount).toEqual(0);
expect(pageTestingHelper.router.replace).toHaveBeenCalledWith("/404");
});

it("does not render the next button", () => {
pageTestingHelper.loadQuery({
Query() {
return {
projectRevision: null,
};
},
});
expect(screen.queryByText(/next/i)).not.toBeInTheDocument();
});
});

0 comments on commit 8720ab1

Please sign in to comment.