Skip to content

Commit

Permalink
Merge pull request #520 from companieshouse/IDVA51337
Browse files Browse the repository at this point in the history
IDVA51337-- [Registration] Sole Trader Only IDV - Feature Flag
  • Loading branch information
rdas-ch authored Nov 4, 2024
2 parents 6760942 + 114fd89 commit b6015d6
Show file tree
Hide file tree
Showing 23 changed files with 175 additions and 67 deletions.
6 changes: 4 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import logger from "./utils/logger";
import routerDispatch from "./router.dispatch";
import cookieParser from "cookie-parser";
import { authenticationMiddleware } from "./middleware/authentication_middleware";
import { authenticationMiddlewareForSoleTrader } from "./middleware/authentication_middleware_sole_trader";
import { sessionMiddleware } from "./middleware/session_middleware";

import {
Expand All @@ -16,7 +17,7 @@ import {
PIWIK_URL,
PIWIK_SITE_ID
} from "./utils/properties";
import { BASE_URL, HEALTHCHECK, ACCESSIBILITY_STATEMENT } from "./types/pageURL";
import { BASE_URL, SOLE_TRADER, HEALTHCHECK, ACCESSIBILITY_STATEMENT } from "./types/pageURL";
import { commonTemplateVariablesMiddleware } from "./middleware/common_variables_middleware";
import { getLocalesService, selectLang } from "./utils/localise";
import { ErrorService } from "./services/errorService";
Expand Down Expand Up @@ -54,7 +55,8 @@ app.use(express.static(path.join(__dirname, "/../assets/public")));
// Apply middleware
app.use(cookieParser());
app.use(`^(?!(${BASE_URL}${HEALTHCHECK}|${BASE_URL}$|${BASE_URL}${ACCESSIBILITY_STATEMENT}))*`, sessionMiddleware);
app.use(`^(?!(${BASE_URL}${HEALTHCHECK}|${BASE_URL}$|${BASE_URL}${ACCESSIBILITY_STATEMENT}))*`, authenticationMiddleware);
app.use(`^(?!(${BASE_URL}${HEALTHCHECK}|${BASE_URL}$|${BASE_URL}${ACCESSIBILITY_STATEMENT})|(${BASE_URL}${SOLE_TRADER}))*`, authenticationMiddleware);
app.use(`^(${BASE_URL}${SOLE_TRADER})*`, authenticationMiddlewareForSoleTrader);
app.use(commonTemplateVariablesMiddleware);

// Company Auth redirect
Expand Down
10 changes: 6 additions & 4 deletions src/middleware/authentication_middleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextFunction, Request, Response } from "express";
import { AuthOptions, acspProfileCreateAuthMiddleware } from "@companieshouse/web-security-node";

import { CHS_URL } from "../utils/properties";
import { AuthOptions, authMiddleware, acspProfileCreateAuthMiddleware } from "@companieshouse/web-security-node";
import { isActiveFeature } from "../utils/feature.flag";
import { CHS_URL, FEATURE_FLAG_VERIFY_SOLE_TRADER_ONLY } from "../utils/properties";
import { BASE_URL, CHECK_SAVED_APPLICATION } from "../types/pageURL";

export const authenticationMiddleware = (req: Request, res: Response, next: NextFunction) => {
Expand All @@ -11,5 +11,7 @@ export const authenticationMiddleware = (req: Request, res: Response, next: Next
returnUrl: BASE_URL + CHECK_SAVED_APPLICATION
};

return acspProfileCreateAuthMiddleware(authMiddlewareConfig)(req, res, next);
return isActiveFeature(FEATURE_FLAG_VERIFY_SOLE_TRADER_ONLY)
? authMiddleware(authMiddlewareConfig)(req, res, next)
: acspProfileCreateAuthMiddleware(authMiddlewareConfig)(req, res, next);
};
16 changes: 16 additions & 0 deletions src/middleware/authentication_middleware_sole_trader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NextFunction, Request, Response } from "express";
import { AuthOptions, acspProfileCreateAuthMiddleware } from "@companieshouse/web-security-node";

import { CHS_URL } from "../utils/properties";
import { BASE_URL, SOLE_TRADER_WHAT_IS_YOUR_ROLE } from "../types/pageURL";

export const authenticationMiddlewareForSoleTrader = (req: Request, res: Response, next: NextFunction) => {

const authMiddlewareConfig: AuthOptions = {
chsWebUrl: CHS_URL,
returnUrl: BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_ROLE
};

return acspProfileCreateAuthMiddleware(authMiddlewareConfig)(req, res, next);

};
2 changes: 2 additions & 0 deletions src/utils/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ export const PIWIK_START_GOAL_ID = getEnvironmentValue("PIWIK_START_GOAL_ID", "4
export const FEATURE_FLAG_DISABLE_LIMITED_JOURNEY = getEnvironmentValue("FEATURE_FLAG_DISABLE_LIMITED_JOURNEY", "false");

export const FEATURE_FLAG_DISABLE_PARTNERSHIP_JOURNEY = getEnvironmentValue("FEATURE_FLAG_DISABLE_PARTNERSHIP_JOURNEY", "false");

export const FEATURE_FLAG_VERIFY_SOLE_TRADER_ONLY = getEnvironmentValue("FEATURE_FLAG_VERIFY_SOLE_TRADER_ONLY", "false");
2 changes: 2 additions & 0 deletions test/mocks/all_middleware_mock.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import mockAuthenticationMiddleware from "./authentication_middleware_mock";
import mockAuthenticationMiddlewareForSoleTrader from "./authentication_middleware_sole_trader_mock";
import mockSessionMiddleware from "./session_middleware_mock";
import mockCompanyAuthenticationMiddleware from "./company_authentication_middleware_mock";
import mockUKAddressesFromPostcode from "./postcode_lookup_service_mock";

export default {
mockAuthenticationMiddleware,
mockAuthenticationMiddlewareForSoleTrader,
mockSessionMiddleware,
mockCompanyAuthenticationMiddleware,
mockUKAddressesFromPostcode
Expand Down
11 changes: 11 additions & 0 deletions test/mocks/authentication_middleware_sole_trader_mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NextFunction, Request, Response } from "express";
import { authenticationMiddlewareForSoleTrader } from "../../src/middleware/authentication_middleware_sole_trader";
jest.mock("../../src/middleware/authentication_middleware_sole_trader");

// get handle on mocked function
const mockAuthenticationMiddlewareForSoleTrader = authenticationMiddlewareForSoleTrader as jest.Mock;

// tell the mock what to return
mockAuthenticationMiddlewareForSoleTrader.mockImplementation((req: Request, res: Response, next: NextFunction) => next());

export default mockAuthenticationMiddlewareForSoleTrader;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("GET" + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.text).toContain("John Doe");
expect(res.text).toContain("Select the correspondence address");
});
Expand All @@ -34,7 +34,7 @@ describe("GET" + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});

it("should return status 200 when applicantDetails is undefined", async () => {
Expand All @@ -45,14 +45,14 @@ describe("GET" + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});

it("should return status 200", async () => {
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});
it("should render the error page if an error is thrown in get function", async () => {
mockGetAcspRegistration.mockImplementationOnce(() => { throw new Error(); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("Correspondence address auto look up tests", () => {
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.text).toContain("What is the correspondence address?");
});

Expand All @@ -54,7 +54,7 @@ describe("Correspondence address auto look up tests", () => {
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.text).toContain("What is the correspondence address?");
});

Expand All @@ -67,14 +67,14 @@ describe("Correspondence address auto look up tests", () => {
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.text).toContain("What is the correspondence address?");
});
it("should return status 500 after calling GET endpoint and failing", async () => {
mockGetAcspRegistration.mockRejectedValueOnce(new Error("Error getting data"));
const res = await router.get(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(500);
expect(res.text).toContain("Sorry we are experiencing technical difficulties");
});
Expand All @@ -98,7 +98,7 @@ describe("POST" + SOLE_TRADER_AUTO_LOOKUP_ADDRESS, () => {
mockPutAcspRegistration.mockResolvedValueOnce(acspData);
expect(res.status).toBe(302); // Expect a redirect status code
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.header.location).toBe(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS_LIST + "?lang=en");
});

Expand All @@ -118,7 +118,7 @@ describe("POST" + SOLE_TRADER_AUTO_LOOKUP_ADDRESS, () => {
const res = await router.post(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS).send(formData);
expect(res.status).toBe(302); // Expect a redirect status code
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.header.location).toBe(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM + "?lang=en");
});

Expand All @@ -133,7 +133,7 @@ describe("POST" + SOLE_TRADER_AUTO_LOOKUP_ADDRESS, () => {
const res = await router.post(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS).send(formData);
expect(res.status).toBe(302); // Expect a redirect status code
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.header.location).toBe(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM + "?lang=en");
});

Expand Down Expand Up @@ -260,7 +260,7 @@ describe("POST" + SOLE_TRADER_AUTO_LOOKUP_ADDRESS, () => {
const res = await router.post(BASE_URL + SOLE_TRADER_AUTO_LOOKUP_ADDRESS).send(formData);
expect(res.status).toBe(302); // Expect a redirect status code
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.header.location).toBe(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM + "?lang=en");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("GET" + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM, () => {
mockGetAcspRegistration.mockResolvedValueOnce(acspData);
const res = await router.get(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(200);
expect(res.text).toContain("John Doe");
expect(res.text).toContain("Confirm the correspondence address");
Expand All @@ -53,7 +53,7 @@ describe("GET" + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM, () => {
it("should return status 200 when acspData is undefined", async () => {
const res = await router.get(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(200);
});

Expand All @@ -65,7 +65,7 @@ describe("GET" + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM, () => {
mockGetAcspRegistration.mockResolvedValueOnce(acspDataWithoutApplicantDetails);
const res = await router.get(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(200);
});

Expand All @@ -81,7 +81,7 @@ describe("POST SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM", () => {
it("should redirect to /select-aml-supervisor with status 302", async () => {
const res = await router.post(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(302);
expect(res.header.location).toBe(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_EMAIL + "?lang=en");
});
Expand Down Expand Up @@ -157,7 +157,7 @@ describe("POST SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM", () => {
createMockSessionMiddleware(acspDataSameAddress);
const res = await router.post(BASE_URL + SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM).send(formData);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(302);
expect(res.header.location).toBe(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_EMAIL + "?lang=en");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ describe("GET" + SOLE_TRADER_MANUAL_CORRESPONDENCE_ADDRESS, () => {
mockGetAcspRegistration.mockResolvedValueOnce(acspData);
const res = await router.get(BASE_URL + SOLE_TRADER_MANUAL_CORRESPONDENCE_ADDRESS);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(200);
expect(res.text).toContain("Enter the correspondence address");
});

it("should return status 200 when acspData is undefined", async () => {
const res = await router.get(BASE_URL + SOLE_TRADER_MANUAL_CORRESPONDENCE_ADDRESS);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(200);
expect(res.text).toContain("Enter the correspondence address");
});
Expand All @@ -45,7 +45,7 @@ describe("GET" + SOLE_TRADER_MANUAL_CORRESPONDENCE_ADDRESS, () => {
mockGetAcspRegistration.mockResolvedValueOnce(acspDataWithoutApplicantDetails);
const res = await router.get(BASE_URL + SOLE_TRADER_MANUAL_CORRESPONDENCE_ADDRESS);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.status).toBe(200);
expect(res.text).toContain("Enter the correspondence address");
});
Expand Down
4 changes: 2 additions & 2 deletions test/src/controllers/soleTrader/dateOfBirthController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("GET" + SOLE_TRADER_DATE_OF_BIRTH, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_DATE_OF_BIRTH);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.text).toContain("What is your date of birth?");
});

Expand All @@ -41,7 +41,7 @@ describe("GET" + SOLE_TRADER_DATE_OF_BIRTH, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_DATE_OF_BIRTH);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.text).toContain("What is your date of birth?");
});

Expand Down
8 changes: 4 additions & 4 deletions test/src/controllers/soleTrader/nameController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ describe("GET" + SOLE_TRADER_WHAT_IS_YOUR_NAME, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NAME);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});

it("should return status 200", async () => {
mockGetAcspRegistration.mockResolvedValueOnce({});
const res = await router.get(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NAME);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});

it("should return status 200 when applicantDetails is undefined", async () => {
Expand All @@ -42,7 +42,7 @@ describe("GET" + SOLE_TRADER_WHAT_IS_YOUR_NAME, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NAME);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});

it("catch error when rendering the page", async () => {
Expand All @@ -66,7 +66,7 @@ describe("POST" + SOLE_TRADER_WHAT_IS_YOUR_NAME, () => {
});
expect(res.status).toBe(302);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});

// Test for incorrect form details entered, will return 400.
Expand Down
4 changes: 2 additions & 2 deletions test/src/controllers/soleTrader/nationalityController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("GET" + SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
expect(res.text).toContain("What is your nationality?");
});

Expand All @@ -48,7 +48,7 @@ describe("GET" + SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY, () => {
const res = await router.get(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY);
expect(res.status).toBe(200);
expect(mocks.mockSessionMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
expect(mocks.mockAuthenticationMiddlewareForSoleTrader).toHaveBeenCalled();
});

it("catch error when rendering the page", async () => {
Expand Down
Loading

0 comments on commit b6015d6

Please sign in to comment.