From d0c98fe4327861d9ba5a7d11c040327cdb1cd432 Mon Sep 17 00:00:00 2001
From: Tara Epp <102187683+taraepp@users.noreply.github.com>
Date: Fri, 8 Nov 2024 21:12:49 +0000
Subject: [PATCH] little more test cleanup
---
.../__snapshots__/DocumentTable.spec.tsx.snap | 2 +-
.../src/components/forms/RenderSelect.tsx | 3 +-
.../projectSummary/AuthorizationsInvolved.tsx | 2 +-
.../projectSummary/ProjectManagement.tsx | 2 +-
.../ProjectSummaryFormComponents.spec.tsx | 5 ++-
.../AuthorizationsInvolved.spec.tsx.snap | 36 ++++++++++++++-----
.../ProjectDocumentsTab.spec.tsx.snap | 2 +-
.../ProjectDocumentsTabSection.spec.tsx.snap | 2 +-
.../src/redux/selectors/projectSelectors.ts | 6 +++-
services/common/src/setupTests.ts | 11 +++++-
services/common/src/tests/mocks/dataMocks.tsx | 2 +-
11 files changed, 53 insertions(+), 20 deletions(-)
diff --git a/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap b/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap
index 99e4067692..0a65f83f18 100644
--- a/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap
+++ b/services/common/src/components/documents/__snapshots__/DocumentTable.spec.tsx.snap
@@ -744,7 +744,7 @@ exports[`DocumentTable renders properly 1`] = `
void;
- usedOptions: string[];
allowClear?: boolean;
}
@@ -25,7 +24,7 @@ export const RenderSelect: FC = ({
input,
placeholder = "Please select",
data = [],
- onSelect = () => {},
+ onSelect = () => { },
allowClear = true,
disabled = false,
required = false,
diff --git a/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx b/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx
index 064c12554a..39374585cf 100644
--- a/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx
+++ b/services/common/src/components/projectSummary/AuthorizationsInvolved.tsx
@@ -654,7 +654,7 @@ export const AuthorizationsInvolved: FC = ({ f
checked={checked}
onChange={(e) => handleChange(e, child.code)}
>
- {child.description}
+ {child.description}
{checked && (
<>
diff --git a/services/common/src/components/projectSummary/ProjectManagement.tsx b/services/common/src/components/projectSummary/ProjectManagement.tsx
index b5b3b999c4..73dea614de 100644
--- a/services/common/src/components/projectSummary/ProjectManagement.tsx
+++ b/services/common/src/components/projectSummary/ProjectManagement.tsx
@@ -29,7 +29,7 @@ const { Paragraph, Title } = Typography;
const unassignedProjectLeadEntry = {
label: "Unassigned",
- value: null,
+ value: undefined,
};
export const ProjectManagement: FC = () => {
diff --git a/services/common/src/components/projectSummary/ProjectSummaryFormComponents.spec.tsx b/services/common/src/components/projectSummary/ProjectSummaryFormComponents.spec.tsx
index 697f2d27d2..f777711dbe 100644
--- a/services/common/src/components/projectSummary/ProjectSummaryFormComponents.spec.tsx
+++ b/services/common/src/components/projectSummary/ProjectSummaryFormComponents.spec.tsx
@@ -7,7 +7,7 @@ import { LegalLandOwnerInformation } from "./LegalLandOwnerInformation";
import { ReduxWrapper } from "@mds/common/tests/utils/ReduxWrapper";
import * as MOCK from "@mds/common/tests/mocks/dataMocks";
import { AUTHENTICATION, PERMITS, PROJECTS, STATIC_CONTENT } from "@mds/common/constants/reducerTypes";
-import { formatProjectSummary } from "@mds/common/redux/selectors/projectSelectors";
+import { exportForTesting } from "@mds/common/redux/selectors/projectSelectors";
import BasicInformation from "./BasicInformation";
import ProjectLinks from "./ProjectLinks";
import ProjectContacts from "./ProjectContacts";
@@ -21,6 +21,9 @@ import DocumentUpload from "./DocumentUpload";
import { FacilityOperator } from "./FacilityOperator";
import { BrowserRouter } from "react-router-dom";
+const { formatProjectSummary } = exportForTesting;
+
+
const amsAuthTypes = ['AIR_EMISSIONS_DISCHARGE_PERMIT', 'EFFLUENT_DISCHARGE_PERMIT', 'REFUSE_DISCHARGE_PERMIT'];
const project = { project_lead_party_guid: "project_lead_party_guid" };
const formattedProjectSummary = formatProjectSummary(MOCK.PROJECT_SUMMARY, project, amsAuthTypes);
diff --git a/services/common/src/components/projectSummary/__snapshots__/AuthorizationsInvolved.spec.tsx.snap b/services/common/src/components/projectSummary/__snapshots__/AuthorizationsInvolved.spec.tsx.snap
index 0ae132dde5..95e9cb9d35 100644
--- a/services/common/src/components/projectSummary/__snapshots__/AuthorizationsInvolved.spec.tsx.snap
+++ b/services/common/src/components/projectSummary/__snapshots__/AuthorizationsInvolved.spec.tsx.snap
@@ -136,7 +136,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Mines Act permit
@@ -558,7 +560,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Air emissions discharge permit
@@ -692,7 +696,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Effluent discharge permit
@@ -727,7 +733,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Refuse discharge permit
@@ -771,7 +779,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Change approval
@@ -806,7 +816,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Use approval
@@ -842,7 +854,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Water licence
@@ -1109,7 +1123,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Occupant licence to cut
@@ -1376,7 +1392,9 @@ exports[`AuthorizationsInvolved renders properly 1`] = `
/>
-
+
Other legislation
diff --git a/services/common/src/components/projects/__snapshots__/ProjectDocumentsTab.spec.tsx.snap b/services/common/src/components/projects/__snapshots__/ProjectDocumentsTab.spec.tsx.snap
index f048563a18..02f6178d8b 100644
--- a/services/common/src/components/projects/__snapshots__/ProjectDocumentsTab.spec.tsx.snap
+++ b/services/common/src/components/projects/__snapshots__/ProjectDocumentsTab.spec.tsx.snap
@@ -1691,7 +1691,7 @@ exports[`ProjectDocumentsTab renders properly 1`] = `
|
|
{
+const formatProjectSummary = (summary, project, amsAuthTypes) => {
const documents = formatProjectSummaryDocuments(summary.documents);
const contacts = formatProjectContact(project.contacts);
const agent = formatProjectSummaryParty(summary.agent);
@@ -165,3 +165,7 @@ export const getFormattedProjectSummary = createSelector(
return formatProjectSummary(summary, project, amsAuthTypes);
}
);
+
+export const exportForTesting = {
+ formatProjectSummary
+}
diff --git a/services/common/src/setupTests.ts b/services/common/src/setupTests.ts
index eb1ea9fe2f..4040b098c4 100644
--- a/services/common/src/setupTests.ts
+++ b/services/common/src/setupTests.ts
@@ -3,6 +3,7 @@ import Adapter from "enzyme-adapter-react-16";
import path from "path";
import "@testing-library/jest-dom";
import server from "@mds/common/tests/server";
+import { rejectHandler } from "./redux/createAppSlice";
require("jest-localstorage-mock");
@@ -53,6 +54,14 @@ jest.mock("@mds/common/providers/featureFlags/useFeatureFlag", () => ({
isFeatureEnabled: () => true,
}),
}));
+
+jest.mock("@mds/common/redux/createAppSlice", () => {
+ const original = jest.requireActual("@mds/common/redux/createAppSlice");
+ return {
+ ...original,
+ rejectHandler: jest.fn(),
+ };
+});
window.scrollTo = jest.fn();
const location = JSON.stringify(window.location);
delete window.location;
@@ -86,7 +95,7 @@ global.document.createElementNS = function (namespaceURI, qualifiedName) {
if (namespaceURI === "http://www.w3.org/2000/svg" && qualifiedName === "svg") {
// eslint-disable-next-line prefer-rest-params
const element = createElementNSOrig.apply(this, arguments);
- element.createSVGRect = function () {};
+ element.createSVGRect = function () { };
return element;
}
// eslint-disable-next-line prefer-rest-params
diff --git a/services/common/src/tests/mocks/dataMocks.tsx b/services/common/src/tests/mocks/dataMocks.tsx
index 5cbd761c5f..534c7f615c 100644
--- a/services/common/src/tests/mocks/dataMocks.tsx
+++ b/services/common/src/tests/mocks/dataMocks.tsx
@@ -7638,7 +7638,7 @@ export const PROJECT_SUMMARY: IProjectSummary = {
project_summary_document_type_code: "SPR",
mine_document_guid: "b869134f-bcf8-47d9-ac61-c90835e20601",
mine_guid: "60300a07-376c-46f1-a984-88a813f91438",
- document_manager_guid: "1c77f818-3d7a-461c-902d-7546755f4661",
+ document_manager_guid: "1c77f818-3d7a-461c-902d-7546755f4662",
document_name: "shape.shx",
upload_date: "2024-06-26 19:51:43.058986+00:00",
create_user: "idir\\username",
|