Skip to content

Commit

Permalink
Add query to mocked getServerSideProps
Browse files Browse the repository at this point in the history
  • Loading branch information
dgcohen committed Nov 19, 2024
1 parent bb480c6 commit e60ed4e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions __test__/pages/hold/eddRequestPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ describe("EDD Request page", () => {
params: { id },
req: mockReq,
res: mockRes,
query: {},
})
expect(responseWithZeroRedirects.redirect).toBeDefined()
const responseWithTwoRedirects = await getServerSideProps({
params: { id: "123-456" },
req: { ...mockReq, cookies: { nyplAccountRedirects: 2 } },
res: mockRes,
query: {},
})
expect(responseWithTwoRedirects.redirect).toBeDefined()
})
Expand All @@ -95,6 +97,7 @@ describe("EDD Request page", () => {
params: { id },
req: mockReq,
res: mockRes,
query: {},
})
expect(responseWithoutRedirect.redirect).not.toBeDefined()
})
Expand All @@ -103,6 +106,7 @@ describe("EDD Request page", () => {
params: { id },
req: mockReq,
res: mockRes,
query: {},
})
expect(response.redirect).toBeUndefined()
})
Expand All @@ -118,6 +122,7 @@ describe("EDD Request page", () => {
params: { id },
res: mockRes,
req: mockReq,
query: {},
})
expect(mockRes.setHeader.mock.calls[0]).toStrictEqual([
"Set-Cookie",
Expand All @@ -143,6 +148,7 @@ describe("EDD Request page", () => {
params: { id },
res: mockRes,
req: mockReq,
query: {},
})
expect(responseWithAeonRedirect.redirect).toStrictEqual({
destination: bibWithSingleAeonItem.resource.items[0].aeonUrl[0],
Expand Down

0 comments on commit e60ed4e

Please sign in to comment.