-
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 #1354 from govuk-one-login/AUT-2093-part-1
AUT-2093-part-1: Remove previous implementation of reauth landing screen
- Loading branch information
Showing
6 changed files
with
8 additions
and
134 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ import { | |
} from "mock-req-res"; | ||
import { EnterEmailServiceInterface } from "../../enter-email/types"; | ||
import { ERROR_CODES } from "../../common/constants"; | ||
import { CheckReauthServiceInterface } from "../../check-reauth-users/types"; | ||
import * as journey from "../../common/journey/journey"; | ||
|
||
describe("enter password controller", () => { | ||
|
@@ -41,78 +40,11 @@ describe("enter password controller", () => { | |
}); | ||
|
||
describe("enterPasswordGet", () => { | ||
const fakeService: CheckReauthServiceInterface = { | ||
checkReauthUsers: sinon.fake.returns({ | ||
success: true, | ||
}), | ||
} as unknown as CheckReauthServiceInterface; | ||
|
||
it("should render enter password view", async () => { | ||
await enterPasswordGet(fakeService)(req as Request, res as Response); | ||
|
||
expect(res.render).to.have.calledWith("enter-password/index.njk"); | ||
}); | ||
|
||
it("should render enter password view when supportReauthentication flag is switched off", async () => { | ||
process.env.SUPPORT_REAUTHENTICATION = "0"; | ||
|
||
await enterPasswordGet(fakeService)(req as Request, res as Response); | ||
|
||
expect(res.render).to.have.calledWith("enter-password/index.njk"); | ||
}); | ||
|
||
it("should render enter password view when isReautheticationRequired is false", async () => { | ||
process.env.SUPPORT_REAUTHENTICATION = "1"; | ||
res.locals.sessionId = "123456-djjad"; | ||
res.locals.clientSessionId = "00000-djjad"; | ||
res.locals.persistentSessionId = "dips-123456-abc"; | ||
req.session.user = { | ||
email: "[email protected]", | ||
}; | ||
|
||
await enterPasswordGet(fakeService)(req as Request, res as Response); | ||
|
||
expect(res.render).to.have.calledWith("enter-password/index.njk"); | ||
}); | ||
|
||
it("should render enter password view when isReautheticationRequired is true and check service returns successfully", async () => { | ||
process.env.SUPPORT_REAUTHENTICATION = "1"; | ||
res.locals.sessionId = "123456-djjad"; | ||
res.locals.clientSessionId = "00000-djjad"; | ||
res.locals.persistentSessionId = "dips-123456-abc"; | ||
req.session.user = { | ||
email: "[email protected]", | ||
reauthenticate: "12345", | ||
}; | ||
|
||
await enterPasswordGet(fakeService)(req as Request, res as Response); | ||
enterPasswordGet(req as Request, res as Response); | ||
|
||
expect(res.render).to.have.calledWith("enter-password/index.njk"); | ||
}); | ||
|
||
it("should render 500 error view when isReautheticationRequired is true and check service fails", async () => { | ||
const unsuccessfulFakeService: CheckReauthServiceInterface = { | ||
checkReauthUsers: sinon.fake.returns({ | ||
success: false, | ||
}), | ||
} as unknown as CheckReauthServiceInterface; | ||
|
||
process.env.SUPPORT_REAUTHENTICATION = "1"; | ||
res.locals.sessionId = "123456-djjad"; | ||
res.locals.clientSessionId = "00000-djjad"; | ||
res.locals.persistentSessionId = "dips-123456-abc"; | ||
req.session.user = { | ||
email: "[email protected]", | ||
reauthenticate: "12345", | ||
}; | ||
|
||
await enterPasswordGet(unsuccessfulFakeService)( | ||
req as Request, | ||
res as Response | ||
); | ||
|
||
expect(res.render).to.have.calledWith("common/errors/500.njk"); | ||
}); | ||
}); | ||
|
||
describe("enterPasswordPost", () => { | ||
|
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