Update tests to use most recent jest and supporting libraries

This commit is contained in:
Ryan Ahearn
2022-10-27 11:12:39 -04:00
parent 98b772f959
commit bb2d57b27b
14 changed files with 1080 additions and 109 deletions

View File

@@ -99,9 +99,6 @@ describe('Authenticate with security key', () => {
})
test('authenticates and passes a redirect url through to the authenticate admin endpoint', (done) => {
// https://github.com/facebook/jest/issues/890#issuecomment-415202799
window.history.pushState({}, 'Test Title', '/?next=%2Ffoo%3Fbar%3Dbaz')
jest.spyOn(window, 'fetch')
.mockImplementationOnce((_url) => {
// initial fetch of options from the server
@@ -131,11 +128,11 @@ 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?next=%2Ffoo%3Fbar%3Dbaz'
'https://www.notifications.service.gov.uk/webauthn/authenticate'
)
return Promise.resolve({
ok: true, arrayBuffer: () => Promise.resolve(window.CBOR.encode({ redirect_url: '/foo' }))
})
})
})
jest.spyOn(window.location, 'assign').mockImplementation((href) => {