diff --git a/services/ui-src/src/components/modals/AddEditReportModal.test.tsx b/services/ui-src/src/components/modals/AddEditReportModal.test.tsx index e5f03a59..bd773bf7 100644 --- a/services/ui-src/src/components/modals/AddEditReportModal.test.tsx +++ b/services/ui-src/src/components/modals/AddEditReportModal.test.tsx @@ -1,12 +1,12 @@ -import { fireEvent, render, screen } from "@testing-library/react"; +import { render, screen } from "@testing-library/react"; import { axe } from "jest-axe"; -//components import { AddEditReportModal } from "components"; import { mockStateUserStore, RouterWrappedComponent, } from "utils/testing/setupJest"; import { useStore } from "utils"; +import userEvent from "@testing-library/user-event"; const mockCloseHandler = jest.fn(); const mockReportHandler = jest.fn(); @@ -39,17 +39,17 @@ describe("Test AddEditProgramModal", () => { }); test("AddEditReportModal shows the contents", () => { - expect(screen.getByText("QMS report name")).toBeTruthy(); - expect(screen.getByText("Start new")).toBeTruthy(); + expect(screen.getByText("QMS report name")).toBeVisible(); + expect(screen.getByText("Start new")).toBeVisible(); }); test("AddEditReportModal top close button can be clicked", () => { - fireEvent.click(screen.getByText("Close")); + userEvent.click(screen.getByText("Close")); expect(mockCloseHandler).toHaveBeenCalledTimes(1); }); test("AddEditReportModal bottom cancel button can be clicked", () => { - fireEvent.click(screen.getByText("Cancel")); + userEvent.click(screen.getByText("Cancel")); expect(mockCloseHandler).toHaveBeenCalledTimes(1); }); }); diff --git a/services/ui-src/src/components/modals/AddEditReportModal.tsx b/services/ui-src/src/components/modals/AddEditReportModal.tsx index e578143a..ce926f5c 100644 --- a/services/ui-src/src/components/modals/AddEditReportModal.tsx +++ b/services/ui-src/src/components/modals/AddEditReportModal.tsx @@ -20,12 +20,12 @@ export const AddEditReportModal = ({ const onSubmit = async (formData: any) => { setSubmitting(true); - const reportOptions: any = { + const reportOptions: ReportOptions = { name: "", - } as ReportOptions; + }; - if (formData["reportTitle"]) { - reportOptions["name"] = formData["reportTitle"].answer; + if (formData.reportTitle) { + reportOptions.name = formData.reportTitle.answer; } await createReport(reportType, activeState, reportOptions); diff --git a/services/ui-src/src/components/pages/Dashboard/DashboardPage.tsx b/services/ui-src/src/components/pages/Dashboard/DashboardPage.tsx index f384e6ab..f9497167 100644 --- a/services/ui-src/src/components/pages/Dashboard/DashboardPage.tsx +++ b/services/ui-src/src/components/pages/Dashboard/DashboardPage.tsx @@ -32,9 +32,6 @@ export const DashboardPage = () => { const { intro, body } = dashboardVerbiage; const fullStateName = StateNames[state as keyof typeof StateNames]; - // TO-DO: update accordingly - if a user is an admin or a read-only type, use the selected state, otherwise use their assigned state - const activeState = state; - useEffect(() => { if (!isReportType(reportType) || !isStateAbbr(state)) { return; @@ -97,7 +94,7 @@ export const DashboardPage = () => {