mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -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) => {
|
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')
|
jest.spyOn(window, 'fetch')
|
||||||
.mockImplementationOnce((_url) => {
|
.mockImplementationOnce((_url) => {
|
||||||
// initial fetch of options from the server
|
// initial fetch of options from the server
|
||||||
@@ -128,7 +129,7 @@ describe('Authenticate with security key', () => {
|
|||||||
.mockImplementationOnce((url, options = {}) => {
|
.mockImplementationOnce((url, options = {}) => {
|
||||||
// subsequent POST of credential data to server
|
// subsequent POST of credential data to server
|
||||||
expect(url.toString()).toEqual(
|
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({
|
return Promise.resolve({
|
||||||
ok: true, arrayBuffer: () => Promise.resolve(window.CBOR.encode({ redirect_url: '/foo' }))
|
ok: true, arrayBuffer: () => Promise.resolve(window.CBOR.encode({ redirect_url: '/foo' }))
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ let _location = {
|
|||||||
href: "https://www.notifications.service.gov.uk",
|
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', {
|
Object.defineProperty(window, 'location', {
|
||||||
get: () => _location,
|
get: () => _location,
|
||||||
set: (value) => {
|
set: (value) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user