Skip to content

Commit

Permalink
Merge pull request #166 from companieshouse/feature/add-psc-type-vali…
Browse files Browse the repository at this point in the history
…dation

Fix error message placement in PSC Type screen
  • Loading branch information
hepsimo authored Nov 20, 2024
2 parents e3b245a + cbe7e5c commit 3755fcb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/views/router_views/psc_type/psc_type.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

<form action="" method="post">
{% include "includes/csrf_token.njk" %}
<div class="govuk-form-group{{ ' govuk-form-group--error' if errors.pscType is not undefined }}">
{{ govukRadios({
{{ govukRadios({
idPrefix: "pscType",
name: "pscType",
value: pscType,
Expand All @@ -22,7 +21,9 @@
classes: "govuk-fieldset__legend--l"
}
},
errorMessage: errors.pscType.inline if errors.pscType,
errorMessage: {
text: errors.pscType.inline
} if errors.pscType,
items: [
{
value: "individual",
Expand All @@ -45,7 +46,6 @@
]
})
}}
</div>

{{ govukDetails({
summaryText: i18n.psc_type_details_title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpStatusCode } from "axios";
import { COMPANY_NUMBER, CREATED_RESOURCE, PSC_VERIFICATION_ID, TRANSACTION_ID } from "../../../mocks/pscVerification.mock";
import { COMPANY_NUMBER, INDIVIDUAL_VERIFICATION_CREATED, PSC_VERIFICATION_ID, TRANSACTION_ID } from "../../../mocks/pscVerification.mock";
import { VALID_COMPANY_PSC_ITEMS } from "../../../mocks/companyPsc.mock";
import { getCompanyProfile } from "../../../../src/services/companyProfileService";
import { getPscVerification } from "../../../../src/services/pscVerificationService";
Expand All @@ -13,7 +13,7 @@ jest.mock("../../../../src/services/pscVerificationService");
const mockGetPscVerification = getPscVerification as jest.Mock;
mockGetPscVerification.mockResolvedValueOnce({
httpStatusCode: HttpStatusCode.Ok,
resource: CREATED_RESOURCE
resource: INDIVIDUAL_VERIFICATION_CREATED
});

jest.mock("../../../../src/services/companyProfileService");
Expand Down Expand Up @@ -45,7 +45,7 @@ describe("psc type handler", () => {
}
});

const res = httpMocks.createResponse({ locals: { submission: CREATED_RESOURCE } });
const res = httpMocks.createResponse({ locals: { submission: INDIVIDUAL_VERIFICATION_CREATED } });
const handler = new IndividualPscListHandler();

const { templatePath, viewData } = await handler.executeGet(req, res);
Expand Down
4 changes: 2 additions & 2 deletions test/routers/handlers/psc-type/pscType.int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import middlewareMocks from "../../../mocks/allMiddleware.mock";
import app from "../../../../src/app";
import { PrefixedUrls } from "../../../../src/constants";
import { getUrlWithTransactionIdAndSubmissionId } from "../../../../src/utils/url";
import { CREATED_RESOURCE, PSC_VERIFICATION_ID, TRANSACTION_ID } from "../../../mocks/pscVerification.mock";
import { INDIVIDUAL_VERIFICATION_CREATED, PSC_VERIFICATION_ID, TRANSACTION_ID } from "../../../mocks/pscVerification.mock";
import { getPscVerification } from "../../../../src/services/pscVerificationService";
import { URLSearchParams } from "url";

jest.mock("../../../../src/services/pscVerificationService", () => ({
getPscVerification: () => ({
httpStatusCode: HttpStatusCode.Ok,
resource: CREATED_RESOURCE
resource: INDIVIDUAL_VERIFICATION_CREATED
})
}));

Expand Down
4 changes: 2 additions & 2 deletions test/routers/pscTypeRouter.int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import middlewareMocks from "../mocks/allMiddleware.mock";
import request from "supertest";
import { PrefixedUrls } from "../../src/constants";
import app from "../../src/app";
import { COMPANY_NUMBER, CREATED_RESOURCE, PSC_VERIFICATION_ID, TRANSACTION_ID } from "../mocks/pscVerification.mock";
import { COMPANY_NUMBER, INDIVIDUAL_VERIFICATION_CREATED, PSC_VERIFICATION_ID, TRANSACTION_ID } from "../mocks/pscVerification.mock";
import { HttpStatusCode } from "axios";
import { getUrlWithTransactionIdAndSubmissionId } from "../../src/utils/url";
import { getPscVerification } from "../../src/services/pscVerificationService";

jest.mock("../../src/services/pscVerificationService", () => ({
getPscVerification: () => ({
httpStatusCode: HttpStatusCode.Ok,
resource: CREATED_RESOURCE
resource: INDIVIDUAL_VERIFICATION_CREATED
})
}));

Expand Down

0 comments on commit 3755fcb

Please sign in to comment.