-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(EMS-3533): update start url redirect
- Loading branch information
Showing
7 changed files
with
64 additions
and
15 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
18 changes: 8 additions & 10 deletions
18
e2e-tests/insurance/cypress/e2e/journeys/redirects/redirects.spec.js
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 |
---|---|---|
@@ -1,32 +1,30 @@ | ||
import { LINKS } from '../../../../../content-strings'; | ||
import { INSURANCE_ROUTES } from '../../../../../constants/routes/insurance'; | ||
|
||
const { EXTERNAL } = LINKS; | ||
|
||
const { | ||
ELIGIBILITY: { CHECK_IF_ELIGIBLE }, | ||
MVP_INSURANCE_ROOT, | ||
ROOT, | ||
START_ROOT, | ||
} = INSURANCE_ROUTES; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
|
||
const checkIfEligibleUrl = `${baseUrl}${CHECK_IF_ELIGIBLE}`; | ||
|
||
context(`Insurance - Redirects - '${MVP_INSURANCE_ROOT}' URLs should redirect to the '${ROOT}' equivalent URL`, () => { | ||
describe(`/${MVP_INSURANCE_ROOT}/start`, () => { | ||
it(`should redirect to ${EXTERNAL.FULL_APPLICATION}`, () => { | ||
cy.navigateToUrl('/insurance/start'); | ||
describe(`${MVP_INSURANCE_ROOT}${START_ROOT}`, () => { | ||
it(`should redirect to ${MVP_INSURANCE_ROOT}${START_ROOT}`, () => { | ||
cy.navigateToUrl(`${MVP_INSURANCE_ROOT}${START_ROOT}`); | ||
|
||
cy.assertUrl(EXTERNAL.FULL_APPLICATION); | ||
cy.assertUrl(checkIfEligibleUrl); | ||
}); | ||
}); | ||
|
||
describe(`${MVP_INSURANCE_ROOT}/eligibility/check-if-eligible`, () => { | ||
it(`should redirect to ${CHECK_IF_ELIGIBLE}`, () => { | ||
cy.navigateToUrl('/insurance/eligibility/check-if-eligible'); | ||
|
||
const expectedUrl = `${baseUrl}${CHECK_IF_ELIGIBLE}`; | ||
|
||
cy.assertUrl(expectedUrl); | ||
cy.assertUrl(checkIfEligibleUrl); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import get from '.'; | ||
import { INSURANCE_ROUTES } from '../../../constants/routes/insurance'; | ||
import { Request, Response } from '../../../../types'; | ||
import { mockReq, mockRes } from '../../../test-mocks'; | ||
|
||
const { | ||
ELIGIBILITY: { CHECK_IF_ELIGIBLE }, | ||
} = INSURANCE_ROUTES; | ||
|
||
describe('controllers/redirects/start', () => { | ||
let req: Request; | ||
let res: Response; | ||
|
||
beforeEach(() => { | ||
req = mockReq(); | ||
res = mockRes(); | ||
}); | ||
|
||
it('should redirect to a new URL via generateRedirectUrl helper function', () => { | ||
get(req, res); | ||
|
||
expect(res.redirect).toHaveBeenCalledTimes(1); | ||
expect(res.redirect).toHaveBeenCalledWith(CHECK_IF_ELIGIBLE); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { INSURANCE_ROUTES } from '../../../constants/routes/insurance'; | ||
import { Request, Response } from '../../../../types'; | ||
|
||
const { | ||
ELIGIBILITY: { CHECK_IF_ELIGIBLE }, | ||
} = INSURANCE_ROUTES; | ||
|
||
/** | ||
* get | ||
* Redirect an MVP_INSURANCE_ROOT START_ROOT URL to CHECK_IF_ELIGIBLE | ||
* @param {Express.Request} Express request | ||
* @param {Express.Response} Express response | ||
* @returns {Express.Response.redirect} | ||
*/ | ||
const get = (req: Request, res: Response) => res.redirect(CHECK_IF_ELIGIBLE); | ||
|
||
export default get; |
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