Skip to content

Commit

Permalink
updated test to test query string
Browse files Browse the repository at this point in the history
  • Loading branch information
DrogoNevets committed Jan 6, 2025
1 parent 89bb013 commit 6fa838c
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,5 +378,30 @@ describe('QuestionPageController', () => {
expect(headers.location).not.toBe(redirectUrl)
expect(headers.location).toBe(overriddenQuestionUrl)
})

it('should add a query string onto tthe overriden url', async () => {
await session.setState(sectionKey, { [questionKey]: 'block-redirect' })

const redirectUrl = '/dummy/incorrect-url'
const { statusCode, headers } = await server.inject(
withCsrfProtection(
{
method: 'POST',
url: `${questionUrl}?redirect=true`,
payload: {
nextPage: redirectUrl,
[questionKey]: 'block-redirect'
}
},
{
Cookie: session.sessionID
}
)
)

expect(statusCode).toBe(statusCodes.redirect)
expect(headers.location).not.toBe(redirectUrl)
expect(headers.location).toBe(`${overriddenQuestionUrl}?redirect=true`)
})
})
})

0 comments on commit 6fa838c

Please sign in to comment.