diff --git a/services/common/src/interfaces/projects/projectStage.interface.ts b/services/common/src/interfaces/projects/projectStage.interface.ts index 30c6b065d9..03c82c2639 100644 --- a/services/common/src/interfaces/projects/projectStage.interface.ts +++ b/services/common/src/interfaces/projects/projectStage.interface.ts @@ -4,8 +4,9 @@ export interface IProjectStage { title: string; key: string; status: string; - payload: IProjectSummary; - statusHash: any; - required: boolean; - navigateForward: (source: string, status: string) => void; + payload?: IProjectSummary; + statusHash?: any; + required?: boolean; + isOptional?: boolean; + navigateForward?: (source: string, status: string) => void; } diff --git a/services/core-web/src/components/mine/Projects/ProjectStagesTable.tsx b/services/core-web/src/components/mine/Projects/ProjectStagesTable.tsx index 774e49c436..dc0e4ac792 100644 --- a/services/core-web/src/components/mine/Projects/ProjectStagesTable.tsx +++ b/services/core-web/src/components/mine/Projects/ProjectStagesTable.tsx @@ -1,10 +1,10 @@ -import React, { FC } from "react"; +import React, { FC, ReactNode } from "react"; import { Table } from "antd"; import { IProjectStage } from "@mds/common/interfaces/projects/projectStage.interface"; import { ColumnsType } from "antd/es/table"; interface TableProjectStage extends IProjectStage { - link: string; + link?: Element | ReactNode; } interface ProjectStagesTableProps { projectStages: TableProjectStage[]; @@ -45,10 +45,10 @@ export const ProjectStagesTable: FC = ({ projectStages if (text === "STATUS") { label = text; } else { - label = - record.key && record.stage_status - ? `[${record.stage_status_hash[text]}]` || "N/A" - : "[Not submitted]"; + label = "[Not submitted]"; + if (record.key && record.stage_status) { + label = record.stage_status_hash[text] ? `[${record.stage_status_hash[text]}]` : "N/A"; + } } return (
diff --git a/services/core-web/src/tests/components/mine/Projects/ProjectOverviewTab.spec.js b/services/core-web/src/tests/components/mine/Projects/ProjectOverviewTab.spec.js deleted file mode 100644 index 5f1efb8ffa..0000000000 --- a/services/core-web/src/tests/components/mine/Projects/ProjectOverviewTab.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from "react"; -import { shallow } from "enzyme"; -import { ProjectOverviewTab } from "@/components/mine/Projects/ProjectOverviewTab"; -import * as MOCK from "@/tests/mocks/dataMocks"; -import FeatureFlagContext from "@mds/common/providers/featureFlags/featureFlag.context"; - -const props = {}; - -const setupProps = () => { - props.projectSummaryDocumentTypesHash = MOCK.PROJECT_SUMMARY_DOCUMENT_TYPES_HASH; - props.projectSummaryStatusCodesHash = MOCK.PROJECT_SUMMARY_STATUS_ALIAS_CODES_HASH; - props.project = MOCK.PROJECT; -}; - -beforeEach(() => { - setupProps(); -}); - -describe("ProjectOverviewTab", () => { - it("renders properly", () => { - const component = shallow( - true, - }} - > - - - ); - expect(component).toMatchSnapshot(); - }); -}); diff --git a/services/core-web/src/tests/components/mine/Projects/ProjectOverviewTab.spec.tsx b/services/core-web/src/tests/components/mine/Projects/ProjectOverviewTab.spec.tsx new file mode 100644 index 0000000000..df2b0faf95 --- /dev/null +++ b/services/core-web/src/tests/components/mine/Projects/ProjectOverviewTab.spec.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import { render } from "@testing-library/react"; +import { ProjectOverviewTab } from "@/components/mine/Projects/ProjectOverviewTab"; +import * as MOCK from "@/tests/mocks/dataMocks"; +import { PROJECTS, STATIC_CONTENT } from "@mds/common/constants/reducerTypes"; +import { BrowserRouter } from "react-router-dom"; +import { ReduxWrapper } from "@/tests/utils/ReduxWrapper"; + +const initialState = { + [PROJECTS]: { + projects: MOCK.PROJECTS.records, + project: MOCK.PROJECT, + projectSummary: MOCK.PROJECT_SUMMARY, + informationRequirementsTable: MOCK.INFORMATION_REQUIREMENTS_TABLE, + }, + [STATIC_CONTENT]: MOCK.BULK_STATIC_CONTENT_RESPONSE, +}; + +describe("ProjectOverviewTab", () => { + it("renders properly", () => { + const { container } = render( + + + + + + ); + expect(container).toMatchSnapshot(); + }); +}); diff --git a/services/core-web/src/tests/components/mine/Projects/ProjectStagesTable.spec.js b/services/core-web/src/tests/components/mine/Projects/ProjectStagesTable.spec.js deleted file mode 100644 index 11a8658835..0000000000 --- a/services/core-web/src/tests/components/mine/Projects/ProjectStagesTable.spec.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from "react"; -import { shallow } from "enzyme"; -import { ProjectStagesTable } from "@/components/mine/Projects/ProjectStagesTable"; -import * as MOCK from "@/tests/mocks/dataMocks"; - -const props = {}; - -const setupProps = () => { - props.projectStages = [ - { - title: "Project description", - key: 1, - status: "SUB", - payload: MOCK.PROJECT_SUMMARY, - statusHash: MOCK.PROJECT_SUMMARY_STATUS_CODES_HASH, - link: null, - }, - ]; -}; - -beforeEach(() => { - setupProps(); -}); - -describe("ProjectStagesTable", () => { - it("renders properly", () => { - const component = shallow(); - expect(component).toMatchSnapshot(); - }); -}); diff --git a/services/core-web/src/tests/components/mine/Projects/ProjectStagesTable.spec.tsx b/services/core-web/src/tests/components/mine/Projects/ProjectStagesTable.spec.tsx new file mode 100644 index 0000000000..502622b384 --- /dev/null +++ b/services/core-web/src/tests/components/mine/Projects/ProjectStagesTable.spec.tsx @@ -0,0 +1,71 @@ +import React from "react"; +import { render } from "@testing-library/react"; +import { ProjectStagesTable } from "@/components/mine/Projects/ProjectStagesTable"; +import * as MOCK from "@/tests/mocks/dataMocks"; +import { ReduxWrapper } from "@/tests/utils/ReduxWrapper"; + +const projectStages = [ + { + title: "REQUIRED STAGES", + key: "req-stages-id", + status: "STATUS", + isTitle: true, + }, + { + key: "ps-519", + link:
link 1
, + status: "DFT", + statusHash: { + WDN: "Withdrawn", + UNR: "Under review", + SUB: "Submitted", + OHD: "On Hold", + DFT: "Draft", + COM: "Complete", + CHR: "Change Requested", + ASG: "Assigned", + }, + title: "Project description", + }, + { + key: "ps-null", + link:
link 2
, + status: null, + statusHash: { + UNR: "Under review", + SUB: "Submitted", + DFT: "Draft", + CHR: "Change Requested", + APV: "Approved", + }, + title: "Final Application", + }, + { + title: "OPTIONAL STAGES", + key: "opt-stages-id", + status: "STATUS", + isOptional: true, + isTitle: true, + }, + { + isOptional: true, + key: "irt-0", + link:
link 3
, + status: null, + statusHash: { + UNR: "Under review", + SUB: "Submitted", + DFT: "Draft", + CHR: "Change Requested", + APV: "Approved", + }, + title: "Final IRT", + }, +]; + +describe("ProjectStagesTable", () => { + it("renders properly", () => { + const { container } = render(); + expect(container).toMatchSnapshot(); + }); +}); diff --git a/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectOverviewTab.spec.js.snap b/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectOverviewTab.spec.js.snap deleted file mode 100644 index 8c40440cb9..0000000000 --- a/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectOverviewTab.spec.js.snap +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ProjectOverviewTab renders properly 1`] = ` - -`; diff --git a/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectOverviewTab.spec.tsx.snap b/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectOverviewTab.spec.tsx.snap new file mode 100644 index 0000000000..8f856209cd --- /dev/null +++ b/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectOverviewTab.spec.tsx.snap @@ -0,0 +1,599 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ProjectOverviewTab renders properly 1`] = ` +
+
+
+

+ Overview +

+ + + PROJECT DESCRIPTION + + +
+ + + KEY DATES + + +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + Estimated IRT Submission + +
+
+
+ + N/A + +
+
+
+ + Desired date to receive permit/amendment(s) + +
+
+
+ + N/A + +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + Estimated Permit Application Submission + +
+
+
+ + N/A + +
+
+
+ + Anticipated work start + +
+
+
+ + N/A + +
+
+
+
+
+
+

+ Project Stages +

+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ REQUIRED STAGES +
+
+
+
+
+ STATUS +
+
+
+
+
+ + Project description + +
+
+
+ + [Not submitted] + +
+
+ + + +
+
+ + Final Application + +
+
+
+ + [Not submitted] + +
+
+ + + +
+
+
+ OPTIONAL STAGES +
+
+
+
+
+ STATUS +
+
+
+
+
+
+ Final IRT +
+
+
+
+
+ [Not submitted] +
+
+
+ + + +
+
+
+
+
+
+
+
+

+ Related Project Applications +

+
+ Description of related major project applications for this mine are listed below. +
+
+
+
+
+
+
+ + + + + + + + + + + + +
+ Project Title + + Project # + + Status + + Contact + + Last Updated + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Project Contacts +
+
+
+
+
+ + + EMLI Project Lead + + +
+ + Project Lead has not been assigned + +
+
+
+
+
+
+
+
+`; diff --git a/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectStagesTable.spec.js.snap b/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectStagesTable.spec.js.snap deleted file mode 100644 index 2c9f639b74..0000000000 --- a/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectStagesTable.spec.js.snap +++ /dev/null @@ -1,87 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ProjectStagesTable renders properly 1`] = ` - -`; diff --git a/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectStagesTable.spec.tsx.snap b/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectStagesTable.spec.tsx.snap new file mode 100644 index 0000000000..5ad92c8f28 --- /dev/null +++ b/services/core-web/src/tests/components/mine/Projects/__snapshots__/ProjectStagesTable.spec.tsx.snap @@ -0,0 +1,222 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ProjectStagesTable renders properly 1`] = ` +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ REQUIRED STAGES +
+
+
+
+
+ STATUS +
+
+
+
+
+ + Project description + +
+
+
+ + [Draft] + +
+
+
+ link 1 +
+
+
+ + Final Application + +
+
+
+ + [Not submitted] + +
+
+
+ link 2 +
+
+
+
+ OPTIONAL STAGES +
+
+
+
+
+ STATUS +
+
+
+
+
+
+ Final IRT +
+
+
+
+
+ [Not submitted] +
+
+
+
+ link 3 +
+
+
+
+
+
+
+
+
+`;