Skip to content

Commit

Permalink
Merge pull request #712 from companieshouse/feature/ecct-791-handle-e…
Browse files Browse the repository at this point in the history
…rror-responses

Error handling updates and unit tests [ECCT-791]
  • Loading branch information
nevans4-ch authored Jan 9, 2024
2 parents 0b1235e + 2a012d1 commit c9249ae
Show file tree
Hide file tree
Showing 40 changed files with 149 additions and 89 deletions.
40 changes: 22 additions & 18 deletions src/controllers/trading.status.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,31 @@ export const get = (req: Request, res: Response) => {
};

export const post = async (req: Request, res: Response, next: NextFunction) => {
const tradingStatusButtonValue = req.body.tradingStatus;
if (!isRadioButtonValueValid(tradingStatusButtonValue)) {
return next(new Error(getRadioButtonInvalidValueErrorMessage(tradingStatusButtonValue)));
}
const companyNumber = getCompanyNumber(req);
try {
const tradingStatusButtonValue = req.body.tradingStatus;
if (!isRadioButtonValueValid(tradingStatusButtonValue)) {
return next(new Error(getRadioButtonInvalidValueErrorMessage(tradingStatusButtonValue)));
}
const companyNumber = getCompanyNumber(req);

if (tradingStatusButtonValue === RADIO_BUTTON_VALUE.YES) {
await sendTradingStatusUpdate(req, true);
return res.redirect(urlUtils.getUrlToPath(TASK_LIST_PATH, req));
}
if (tradingStatusButtonValue === RADIO_BUTTON_VALUE.YES) {
await sendTradingStatusUpdate(req, true);
return res.redirect(urlUtils.getUrlToPath(TASK_LIST_PATH, req));
}

if (tradingStatusButtonValue === RADIO_BUTTON_VALUE.NO) {
await sendTradingStatusUpdate(req, false);
return res.redirect(urlUtils.getUrlToPath(TRADING_STOP_PATH, req));
}
if (tradingStatusButtonValue === RADIO_BUTTON_VALUE.NO) {
await sendTradingStatusUpdate(req, false);
return res.redirect(urlUtils.getUrlToPath(TRADING_STOP_PATH, req));
}

return res.render(Templates.TRADING_STATUS, {
tradingStatusErrorMsg: TRADING_STATUS_ERROR,
backLinkUrl: getConfirmCompanyUrl(companyNumber),
templateName: Templates.TRADING_STATUS
});
return res.render(Templates.TRADING_STATUS, {
tradingStatusErrorMsg: TRADING_STATUS_ERROR,
backLinkUrl: getConfirmCompanyUrl(companyNumber),
templateName: Templates.TRADING_STATUS
});
} catch (e) {
return next(e);
}
};

const getCompanyNumber = (req: Request): string => req.params[urlParams.PARAM_COMPANY_NUMBER];
Expand Down
8 changes: 7 additions & 1 deletion src/services/eligibility.service.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { createPublicOAuthApiClient } from "./api.service";
import { Session } from "@companieshouse/node-session-handler";
import Resource from "@companieshouse/api-sdk-node/dist/services/resource";
import Resource, { ApiErrorResponse } from "@companieshouse/api-sdk-node/dist/services/resource";
import {
CompanyValidationResponse,
ConfirmationStatementService,
EligibilityStatusCode
} from "@companieshouse/api-sdk-node/dist/services/confirmation-statement";
import { createAndLogError } from "../utils/logger";

export const checkEligibility = async (session: Session, companyNumber: string): Promise<EligibilityStatusCode> => {
const client = createPublicOAuthApiClient(session);
const csService: ConfirmationStatementService = client.confirmationStatementService;
const response: Resource<CompanyValidationResponse> = await csService.getEligibility(companyNumber);
const status = response.httpStatusCode;
if (status >= 400) {
const errorResponse = response as ApiErrorResponse;
throw createAndLogError(`Error retrieving eligibility data from confirmation-statment api: ${JSON.stringify(errorResponse)}`);
}
const companyValidationResponse: CompanyValidationResponse = response.resource as CompanyValidationResponse;
return companyValidationResponse.eligibilityStatusCode;
};
2 changes: 1 addition & 1 deletion test/controllers/confirm.company.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const mockGetNextMadeUpToDate = getNextMadeUpToDate as jest.Mock;

const companyNumber = "12345678";
const today = "2020-04-25";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, the service is unavailable";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, there is a problem with the service";

const useWebFilingRedirectPath = urlUtils.setQueryParam(USE_WEBFILING_PATH, URL_QUERY_PARAM.COMPANY_NUM, validCompanyProfile.companyNumber);

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/confirmation.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe("Confirmation controller tests", () => {
const response = await request(app)
.get(URL);

expect(response.text).toContain("Sorry, the service is unavailable");
expect(response.text).toContain("Sorry, there is a problem with the service");

spyGetTrans.mockRestore();
});
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/error.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Error controller test", () => {
.get(CONFIRM_COMPANY_PATH);

expect(response.status).toEqual(500);
expect(response.text).toContain("Sorry, the service is unavailable");
expect(response.text).toContain("Sorry, there is a problem with the service");
expect(mockLoggerErrorRequest.mock.calls[0][1]).toContain(message);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const TRANSACTION_ID = "12345-12345";
const SUBMISSION_ID = "86dfssfds";
const populatedWrongOfficerDetailsPath = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(WRONG_OFFICER_DETAILS_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const TASK_LIST_URL = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(TASK_LIST_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const ERROR_PAGE_TEXT = "Sorry, the service is unavailable";
const ERROR_PAGE_TEXT = "Sorry, there is a problem with the service";
const WRONG_OFFICER_ERROR = "Select yes if you have updated the officer details";

const mockSendUpdate = sendUpdate as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const TRANSACTION_ID = "12345-12345";
const SUBMISSION_ID = "86dfssfds";
const populatedWrongPscDetailsPath = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(WRONG_PSC_DETAILS_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const TASK_LIST_URL = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(TASK_LIST_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const ERROR_PAGE_TEXT = "Sorry, the service is unavailable";
const ERROR_PAGE_TEXT = "Sorry, there is a problem with the service";
const WRONG_PSC_ERROR = "Select yes if you have updated the PSC details";

const mockSendUpdate = sendUpdate as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const TRANSACTION_ID = "12345-12345";
const SUBMISSION_ID = "86dfssfds";
const populatedWrongPscStatementPath = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(WRONG_PSC_STATEMENT_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const TASK_LIST_URL = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(TASK_LIST_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const ERROR_PAGE_TEXT = "Sorry, the service is unavailable";
const ERROR_PAGE_TEXT = "Sorry, there is a problem with the service";
const WRONG_PSC_ERROR = "Select yes if you have updated the PSC details";
const PSC_STATEMENT_URL = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(PSC_STATEMENT_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const backLinkUrlTrue = urlUtils.setQueryParam(PSC_STATEMENT_URL, URL_QUERY_PARAM.IS_PSC, "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const populatedWrongRegisteredOfficeAddressPath = urlUtils.getUrlWithCompanyNumb
const TASK_LIST_URL = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(TASK_LIST_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const WRONG_ROA_ERROR = "Select yes if you have updated the registered office address";
const WRONG_ROA_PAGE_HEADING = "Incorrect registered office address - File a confirmation statement";
const ERROR_PAGE_TEXT = "Sorry, the service is unavailable";
const ERROR_PAGE_TEXT = "Sorry, there is a problem with the service";

const mockSendUpdate = sendUpdate as jest.Mock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const TRANSACTION_ID = "12345-12345";
const SUBMISSION_ID = "86dfssfds";
const populatedWrongRegisterLocationsAddressPath = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(WRONG_REGISTER_LOCATIONS_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const TASK_LIST_URL = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(TASK_LIST_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const ERROR_PAGE_TEXT = "Sorry, the service is unavailable";
const ERROR_PAGE_TEXT = "Sorry, there is a problem with the service";

const mockSendUpdate = sendUpdate as jest.Mock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const TRANSACTION_ID = "12345-12345";
const SUBMISSION_ID = "86dfssfds";
const populatedWrongStatementOfCapitalPath = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(WRONG_STATEMENT_OF_CAPITAL_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const backLinkUrl = urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(STATEMENT_OF_CAPITAL_PATH, COMPANY_NUMBER, TRANSACTION_ID, SUBMISSION_ID);
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";

describe("Wrong statement of capital stop controller tests", () => {

Expand Down Expand Up @@ -71,5 +72,12 @@ describe("Wrong statement of capital stop controller tests", () => {
expect(response.text).toContain("The total amount unpaid for all shares is missing on this company’s statement of capital.");
expect(response.text).toContain(backLinkUrl);
});

it("Should throw an error if statement of capital lookup throws an error", async () => {
mockGetStatementOfCapitalData.mockRejectedValueOnce(new Error());
const response = await request(app).get(populatedWrongStatementOfCapitalPath);
expect(response.text).toContain(EXPECTED_ERROR_TEXT);
});

});
});
2 changes: 1 addition & 1 deletion test/controllers/invalid.company.status.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mockIsCompanyNumberValid = isCompanyNumberValid as jest.Mock;
mockIsCompanyNumberValid.mockReturnValue(true);

const STOP_PAGE_TITLE_COMPANY_STATUS = "You cannot use this service - Company Status";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, the service is unavailable";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, there is a problem with the service";

describe("Invalid company status controller tests", () => {

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/no.filing.required.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const mockIsCompanyNumberValid = isCompanyNumberValid as jest.Mock;
const mockGetCompanyProfile = getCompanyProfile as jest.Mock;

const NO_FILING_REQUIRED_PAGE_TITLE = "You cannot use this service - Company Type No Filing Required";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, the service is unavailable";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, there is a problem with the service";

describe("No filing required controller tests", () => {

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/paper.filing.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const mockIsCompanyNumberValid = isCompanyNumberValid as jest.Mock;
const mockGetCompanyProfile = getCompanyProfile as jest.Mock;

const USE_PAPER_FILING_PAGE_TITLE = "You cannot use this service - Company Type Paper Filing";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, the service is unavailable";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, there is a problem with the service";

describe("User paper filing controller tests", () => {

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/payment.callback.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("Payment callback controller tests", () => {
.get(successUrl);

expect(response.status).toBe(500);
expect(response.text).toContain("Sorry, the service is unavailable");
expect(response.text).toContain("Sorry, there is a problem with the service");
expect(mocks.mockAuthenticationMiddleware).toHaveBeenCalled();
});
});
2 changes: 1 addition & 1 deletion test/controllers/return.from.rea.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { session } from "../mocks/session.middleware.mock";

const mockSendUpdate = sendUpdate as jest.Mock;

const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";
const COMPANY_NUMBER = "12345678";
const TRANSACTION_ID = "66454";
const SUBMISSION_ID = "435435";
Expand Down
10 changes: 9 additions & 1 deletion test/controllers/review.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const dummyError = {
} as Error;
mockCreateAndLogError.mockReturnValue(dummyError);

const SERVICE_UNAVAILABLE_TEXT = "Sorry, the service is unavailable";
const SERVICE_UNAVAILABLE_TEXT = "Sorry, there is a problem with the service";
const PAYMENT_URL = "/payment/1234";
const PAGE_HEADING = "Submit the confirmation statement";
const ERROR_PAGE_HEADING = "Service offline - File a confirmation statement";
Expand Down Expand Up @@ -192,6 +192,14 @@ describe("review controller tests", () => {
expect(response.text).toContain(CONFIRMATION_STATEMENT_ECCT_TEXT);
expect(response.text).toContain(LAWFUL_ACTIVITY_STATEMENT_TEXT);
});

it("Should redirect to an error page when error is returned", async () => {
mockGetConfirmationStatement.mockRejectedValueOnce(new Error());
const response = await request(app)
.get(URL);
expect(response.text).toContain(SERVICE_UNAVAILABLE_TEXT);
});

});

describe("post tests", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/task.list.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mockInitTaskList.mockReturnValue(mockTaskListNoEmail);
const mockDoesCompanyHaveEmailAddress = doesCompanyHaveEmailAddress as jest.Mock;
mockDoesCompanyHaveEmailAddress.mockReturnValue(true);

const ERROR_TEXT = "Sorry, the service is unavailable";
const ERROR_TEXT = "Sorry, there is a problem with the service";
const COMPANY_NUMBER = "12345678";
const TRANSACTION_ID = "66454";
const SUBMISSION_ID = "435435";
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/tasks/active.directors.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const mockSendUpdate = sendUpdate as jest.Mock;

const COMPANY_NUMBER = "12345678";
const PAGE_HEADING = "Check the director's details";
const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";
const ACTIVE_OFFICER_DETAILS_URL = ACTIVE_OFFICERS_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const TASK_LIST_URL = TASK_LIST_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const WRONG_DETAILS_URL = WRONG_OFFICER_DETAILS_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const mockSendUpdate = sendUpdate as jest.Mock;
const COMPANY_NUMBER = "12345678";
const ACTIVE_OFFICER_DETAILS_URL = ACTIVE_OFFICERS_DETAILS_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const TASK_LIST_URL = TASK_LIST_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";
const PAGE_HEADING = "Check the officers' details";
const WRONG_DETAILS_URL = WRONG_OFFICER_DETAILS_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const COMPANY_NUMBER = "12345678";
const ACTIVE_PSC_DETAILS_URL = ACTIVE_PSC_DETAILS_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const PSC_STATEMENT_URL = PSC_STATEMENT_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const PAGE_HEADING = "Review the people with significant control";
const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";
const WRONG_PSC_DETAILS_URL = WRONG_PSC_DETAILS_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);

const mockGetPscs = getPscs as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const mockSendUpdate = sendUpdate as jest.Mock;

const PAGE_HEADING = "Check registered email address";
const PAGE_CONTENT_SAMPLE = "Is the registered email address correct?";
const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";
const EXPECTED_EMAIL = "[email protected]";
const COMPANY_NUMBER = "12345678";
const TRANSACTION_ID = "66454";
Expand Down
33 changes: 18 additions & 15 deletions test/controllers/tasks/confirm.email.address.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SECTIONS } from "../../../src/utils/constants";
import { SectionStatus } from "@companieshouse/api-sdk-node/dist/services/confirmation-statement";

const PAGE_HEADING = "Check the email address";
const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";
const COMPANY_NUMBER = "12345678";
const TASK_LIST_URL = TASK_LIST_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const CONFIRM_EMAIL_ADDRESS_URL = CONFIRM_EMAIL_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
Expand All @@ -38,29 +38,32 @@ describe("Confirm Email Address controller tests", () => {
expect(response.text).toContain("Email address");
});

it("Should return to task list page when email address is confirmed", async () => {
const response = await request(app).post(CONFIRM_EMAIL_ADDRESS_URL);
expect(mockSendUpdate.mock.calls[0][1]).toBe(SECTIONS.EMAIL);
expect(mockSendUpdate.mock.calls[0][2]).toBe(SectionStatus.INITIAL_FILING);
expect(response.status).toEqual(302);
expect(response.header.location).toEqual(TASK_LIST_URL);
it("Should redirect to an error page when error is thrown", async () => {
const spyGetUrlToPath = jest.spyOn(urlUtils, "getUrlToPath");
spyGetUrlToPath.mockImplementationOnce(() => { throw new Error(); });
const response = await request(app).get(CONFIRM_EMAIL_ADDRESS_URL);

expect(response.text).toContain(EXPECTED_ERROR_TEXT);

spyGetUrlToPath.mockRestore();
});
});

it("Should return to task list page when email address is provided", async () => {
describe("Check registered email address controller POST tests", () => {
it("Should send update and return to task list page when email address is confirmed", async () => {
const response = await request(app).post(CONFIRM_EMAIL_ADDRESS_URL);
expect(mockSendUpdate.mock.calls[0][1]).toBe(SECTIONS.EMAIL);
expect(mockSendUpdate.mock.calls[0][2]).toBe(SectionStatus.INITIAL_FILING);
expect(mockSendUpdate.mock.calls[0][3]).toBe(ENTERED_EMAIL);
expect(response.status).toEqual(302);
expect(response.header.location).toEqual(TASK_LIST_URL);
});

it("Should redirect to an error page when error is thrown", async () => {
const spyGetUrlToPath = jest.spyOn(urlUtils, "getUrlToPath");
spyGetUrlToPath.mockImplementationOnce(() => { throw new Error(); });
const response = await request(app).get(CONFIRM_EMAIL_ADDRESS_URL);

it("Should redirect to an error page when error is returned in POST", async () => {
mockSendUpdate.mockRejectedValueOnce(new Error());
const response = await request(app).post(CONFIRM_EMAIL_ADDRESS_URL);
expect(response.text).toContain(EXPECTED_ERROR_TEXT);

spyGetUrlToPath.mockRestore();
});

});
});
2 changes: 1 addition & 1 deletion test/controllers/tasks/confirm.sic.code.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const mockSendUpdate = sendUpdate as jest.Mock;
const TASK_LIST_URL = TASK_LIST_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const SIC_CODE_URL = SIC_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const WRONG_SIC_URL = WRONG_SIC_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";

jest.mock("../../../src/middleware/company.authentication.middleware");
jest.mock("../../../src/services/company.profile.service");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const REG_NO = "36363";
const SERV_ADD_LINE_1 = "line1";
const REGISTER_LOCATION = "UK";
const COUNTRY_RESIDENCE = "UK";
const ERROR_PAGE_TEXT = "Sorry, the service is unavailable";
const ERROR_PAGE_TEXT = "Sorry, there is a problem with the service";
const TEST_RLE_NAME = "Test Rle Name";
const PEOPLE_WITH_SIGNIFICANT_CONTROL_URL =
urlUtils.getUrlWithCompanyNumberTransactionIdAndSubmissionId(PEOPLE_WITH_SIGNIFICANT_CONTROL_PATH,
Expand Down Expand Up @@ -426,7 +426,7 @@ describe("People with significant control controller tests", () => {
expect(mockCreateAndLogError).toHaveBeenCalledTimes(1);
expect(mockCreateAndLogError).toHaveBeenCalledWith(expect.stringContaining("No PSC data found, no radio button selected"));
expect(response.status).toEqual(500);
expect(response.text).toContain("Sorry, the service is unavailable");
expect(response.text).toContain("Sorry, there is a problem with the service");
});

it("Should redirect to psc statement page when Recently Filed radio button is selected", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const mockCompanyAuthenticationMiddleware = companyAuthenticationMiddleware as j
mockCompanyAuthenticationMiddleware.mockImplementation((req, res, next) => next());

const PAGE_HEADING = "Registered email address";
const EXPECTED_ERROR_TEXT = "Sorry, the service is unavailable";
const EXPECTED_ERROR_TEXT = "Sorry, there is a problem with the service";
const COMPANY_NUMBER = "12345678";

const PROVIDE_EMAIL_ADDRESS_URL = PROVIDE_EMAIL_ADDRESS_PATH.replace(`:${urlParams.PARAM_COMPANY_NUMBER}`, COMPANY_NUMBER);
Expand Down
Loading

0 comments on commit c9249ae

Please sign in to comment.