Skip to content

Commit

Permalink
cover dropdown year
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocio De Santiago authored and Rocio De Santiago committed Jan 9, 2025
1 parent 5f91e2d commit 9ffdf5d
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { axe } from "jest-axe";
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();
Expand Down Expand Up @@ -106,6 +106,28 @@ describe("Test Edit Report Modal", () => {
});
});

describe("Test dropdown for year", () => {
beforeEach(() => {
render(addModalComponent);
});

test("Assert dropdown options are rendered", () => {
const dropdown = screen.getByRole("combobox", {
name: "Select the quality measure set reporting year",
}) as HTMLSelectElement;
expect(dropdown).toBeInTheDocument();
expect(dropdown.options.length).toBe(1);
});

test("Simulate selecting a year", () => {
const dropdown = screen.getByRole("combobox", {
name: "Select the quality measure set reporting year",
}) as HTMLSelectElement;
userEvent.selectOptions(dropdown, "2026");
expect(dropdown.value).toBe("2026");
});
});

describe("Test AddEditReportModal accessibility", () => {
it("Should not have basic accessibility issues", async () => {
const { container } = render(addModalComponent);
Expand Down

0 comments on commit 9ffdf5d

Please sign in to comment.