Skip to content

Commit

Permalink
chore: fixed vitests in admin/OperationInformationForm
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-williams committed Feb 6, 2025
1 parent d041c4e commit 67d81d5
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getBusinessStructures,
getNaicsCodes,
getOperationWithDocuments,
getRegistrationPurposes,
getRegulatedProducts,
getReportingActivities,
} from "./mocks";
Expand Down Expand Up @@ -93,7 +94,10 @@ export const fetchFormEnums = () => {
});

// Registration purposes
actionHandler.mockResolvedValue(["Potential Reporting Operation"]);
getRegistrationPurposes.mockResolvedValue([
"Potential Reporting Operation",
"Reporting Operation",
]);
};

// Just using a simple schema for testing purposes
Expand Down Expand Up @@ -307,7 +311,9 @@ describe("the OperationInformationForm component", () => {
/The purpose of this registration is to register as a\:/i,
),
).toBeVisible();
expect(screen.getByText(/Reporting Operation/i)).toBeVisible();
const reportingOperationLabels =
screen.getAllByText(/Reporting Operation/i);
expect(reportingOperationLabels.length === 2); // first is the from the Registration Purpose field, second is a section header
});

it("should enable editing when the Edit button is clicked", async () => {
Expand Down Expand Up @@ -908,7 +914,7 @@ describe("the OperationInformationForm component", () => {
);
await userEvent.click(screen.getByRole("button", { name: "Edit" }));
const cancelChipIcon = screen.getAllByTestId("CancelIcon");
await userEvent.click(cancelChipIcon[2]); // 0-1 are activities
await userEvent.click(cancelChipIcon[0]);
expect(screen.queryByText(/ivy/i)).not.toBeInTheDocument();
const operationRepresentativesComboBoxInput = screen.getByRole(
"combobox",
Expand Down Expand Up @@ -939,12 +945,12 @@ describe("the OperationInformationForm component", () => {
type: "Single Facility Operation",
naics_code_id: 1,
secondary_naics_code_id: 2,
activities: [1, 2],
process_flow_diagram: mockDataUri,
boundary_map: mockDataUri,
operation_has_multiple_operators: false,
registration_purpose: "Reporting Operation",
operation_representatives: [2],
activities: [1, 2],
}),
},
);
Expand Down

0 comments on commit 67d81d5

Please sign in to comment.