mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-28 01:50:12 -04:00
Address PR feedback
This commit is contained in:
@@ -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' }))
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user