Address PR feedback

This commit is contained in:
Ryan Ahearn
2022-10-27 18:16:24 +00:00
parent 55abdae45d
commit e335487b9e
2 changed files with 4 additions and 1 deletions

View File

@@ -99,6 +99,7 @@ describe('Authenticate with security key', () => {
})
test('authenticates and passes a redirect url through to the authenticate admin endpoint', (done) => {
window.location.href = `${window.location.href}?next=%2Ffoo%3Fbar%3Dbaz`
jest.spyOn(window, 'fetch')
.mockImplementationOnce((_url) => {
// initial fetch of options from the server
@@ -128,7 +129,7 @@ describe('Authenticate with security key', () => {
.mockImplementationOnce((url, options = {}) => {
// subsequent POST of credential data to server
expect(url.toString()).toEqual(
'https://www.notifications.service.gov.uk/webauthn/authenticate'
'https://www.notifications.service.gov.uk/webauthn/authenticate?next=%2Ffoo%3Fbar%3Dbaz'
)
return Promise.resolve({
ok: true, arrayBuffer: () => Promise.resolve(window.CBOR.encode({ redirect_url: '/foo' }))

View File

@@ -7,6 +7,8 @@ let _location = {
href: "https://www.notifications.service.gov.uk",
}
// JSDOM provides a read-only window.location, which does not allow for
// mocking or setting.
Object.defineProperty(window, 'location', {
get: () => _location,
set: (value) => {