Skip to content

Commit

Permalink
Add query getServerSideProps params in test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgcohen committed Jan 2, 2025
1 parent 75b883e commit b2c07c1
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 @@ -93,12 +93,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 @@ -115,6 +117,7 @@ describe("EDD Request page", () => {
params: { id },
req: mockReq,
res: mockRes,
query: {},
})
expect(responseWithoutRedirect.redirect).not.toBeDefined()
})
Expand All @@ -123,6 +126,7 @@ describe("EDD Request page", () => {
params: { id },
req: mockReq,
res: mockRes,
query: {},
})
expect(response.redirect).toBeUndefined()
})
Expand All @@ -138,6 +142,7 @@ describe("EDD Request page", () => {
params: { id },
res: mockRes,
req: mockReq,
query: {},
})
expect(mockRes.setHeader.mock.calls[0]).toStrictEqual([
"Set-Cookie",
Expand All @@ -163,6 +168,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 b2c07c1

Please sign in to comment.