-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1638 from govuk-one-login/BAU/use-common-variable…
…s-in-more-tests Bau/use common variables in more tests
- Loading branch information
Showing
34 changed files
with
78 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,21 @@ import { PATH_NAMES } from "../../../../app.constants"; | |
import { mockResponse, RequestOutput, ResponseOutput } from "mock-req-res"; | ||
import { SendNotificationServiceInterface } from "../../../common/send-notification/types"; | ||
import { createMockRequest } from "../../../../../test/helpers/mock-request-helper"; | ||
import { commonVariables } from "../../../../../test/helpers/common-test-variables"; | ||
|
||
describe("resend mfa controller", () => { | ||
let req: RequestOutput; | ||
let res: ResponseOutput; | ||
const { sessionId, clientSessionId, diPersistentSessionId, ip, email } = | ||
commonVariables; | ||
|
||
beforeEach(() => { | ||
req = createMockRequest(PATH_NAMES.CHECK_YOUR_PHONE); | ||
req.ip = ip; | ||
res = mockResponse(); | ||
res.locals.sessionId = sessionId; | ||
res.locals.clientSessionId = clientSessionId; | ||
res.locals.persistentSessionId = diPersistentSessionId; | ||
}); | ||
|
||
afterEach(() => { | ||
|
@@ -44,10 +51,6 @@ describe("resend mfa controller", () => { | |
}), | ||
} as unknown as SendNotificationServiceInterface; | ||
|
||
res.locals.sessionId = "123456-djjad"; | ||
req.session.user = { | ||
email: "[email protected]", | ||
}; | ||
req.path = PATH_NAMES.RESEND_MFA_CODE_ACCOUNT_CREATION; | ||
|
||
await resendMfaCodePost(fakeService)(req as Request, res as Response); | ||
|
@@ -62,24 +65,20 @@ describe("resend mfa controller", () => { | |
success: true, | ||
}), | ||
} as unknown as SendNotificationServiceInterface; | ||
res.locals.sessionId = "123456-djjad"; | ||
res.locals.clientSessionId = "654321-djjad"; | ||
res.locals.persistentSessionId = "123123-djjad"; | ||
|
||
req.session.user = { | ||
email: "[email protected]", | ||
email, | ||
isAccountRecoveryJourney: true, | ||
}; | ||
req.path = PATH_NAMES.RESEND_MFA_CODE_ACCOUNT_CREATION; | ||
req.ip = "127.0.0.1"; | ||
await resendMfaCodePost(fakeService)(req as Request, res as Response); | ||
expect(fakeService.sendNotification).to.have.been.calledWith( | ||
"123456-djjad", | ||
"654321-djjad", | ||
"[email protected]", | ||
sessionId, | ||
clientSessionId, | ||
email, | ||
"VERIFY_PHONE_NUMBER", | ||
"127.0.0.1", | ||
"123123-djjad", | ||
ip, | ||
diPersistentSessionId, | ||
"", | ||
req, | ||
"ACCOUNT_RECOVERY" | ||
|
@@ -92,24 +91,20 @@ describe("resend mfa controller", () => { | |
success: true, | ||
}), | ||
} as unknown as SendNotificationServiceInterface; | ||
res.locals.sessionId = "123456-djjad"; | ||
res.locals.clientSessionId = "654321-djjad"; | ||
res.locals.persistentSessionId = "123123-djjad"; | ||
|
||
req.session.user = { | ||
email: "[email protected]", | ||
email, | ||
isAccountCreationJourney: true, | ||
}; | ||
req.path = PATH_NAMES.RESEND_MFA_CODE_ACCOUNT_CREATION; | ||
req.ip = "127.0.0.1"; | ||
await resendMfaCodePost(fakeService)(req as Request, res as Response); | ||
expect(fakeService.sendNotification).to.have.been.calledWith( | ||
"123456-djjad", | ||
"654321-djjad", | ||
"[email protected]", | ||
sessionId, | ||
clientSessionId, | ||
email, | ||
"VERIFY_PHONE_NUMBER", | ||
"127.0.0.1", | ||
"123123-djjad", | ||
ip, | ||
diPersistentSessionId, | ||
"", | ||
req, | ||
"REGISTRATION" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.