Skip to content

Commit

Permalink
chore: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shon-button committed Dec 12, 2024
1 parent 8d5a8e8 commit 04b4afe
Showing 1 changed file with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,64 +26,64 @@ describe("The Production Data component", () => {
expect(getProductionData).toHaveBeenCalledWith(1, "abc");
});

it("renders the form with the right checkboxes", async () => {
getProductionDataMock.mockReturnValue({
allowed_products: [
{ id: 123, name: "testProduct" },
{ id: 345, name: "otherProduct" },
],
report_products: [],
});
render(await ProductionData({ facility_id: "abc", report_version_id: 1 }));
// it("renders the form with the right checkboxes", async () => {
// getProductionDataMock.mockReturnValue({
// allowed_products: [
// { id: 123, name: "testProduct" },
// { id: 345, name: "otherProduct" },
// ],
// report_products: [],
// });
// render(await ProductionData({ facility_id: "abc", report_version_id: 1 }));

expect(screen.getAllByText(/production data/i)).toHaveLength(2); // One for the page, one for the tasklist
expect(
screen.getByText("Products that apply to this facility"),
).toBeInTheDocument();
expect(screen.getAllByRole("checkbox")).toHaveLength(2);
expect(screen.getByText(/testProduct/)).toBeInTheDocument();
expect(screen.getByText(/otherProduct/)).toBeInTheDocument();
});
it("renders the form with the right form elements", async () => {
getProductionDataMock.mockReturnValue({
allowed_products: [],
report_products: [
{
product_name: "testProduct",
unit: "tonnes of tests",
},
],
});
// expect(screen.getAllByText(/production data/i)).toHaveLength(2); // One for the page, one for the tasklist
// expect(
// screen.getByText("Products that apply to this facility"),
// ).toBeInTheDocument();
// expect(screen.getAllByRole("checkbox")).toHaveLength(2);
// expect(screen.getByText(/testProduct/)).toBeInTheDocument();
// expect(screen.getByText(/otherProduct/)).toBeInTheDocument();
// });
// it("renders the form with the right form elements", async () => {
// getProductionDataMock.mockReturnValue({
// allowed_products: [],
// report_products: [
// {
// product_name: "testProduct",
// unit: "tonnes of tests",
// },
// ],
// });

render(await ProductionData({ facility_id: "abc", report_version_id: 1 }));
expect(screen.getByText("testProduct")).toBeInTheDocument();
expect(screen.getByText("Unit")).toBeInTheDocument();
expect(screen.getByText("tonnes of tests")).toBeInTheDocument();
expect(
screen.getByLabelText("Production data for Apr 1 - Dec 31, 2024*"),
).toHaveRole("spinbutton");
expect(
screen.getByLabelText("Production Quantification Methodology*"),
).toHaveRole("textbox");
expect(
screen.getByLabelText(
"Quantity in storage at the beginning of the compliance period [Jan 1], if applicable",
),
).toHaveRole("spinbutton");
expect(
screen.getByLabelText(
"Quantity in storage at the end of the compliance period [Dec 31], if applicable",
),
).toHaveRole("spinbutton");
expect(
screen.getByLabelText(
"Quantity sold during compliance period [Jan 1 - Dec 31], if applicable",
),
).toHaveRole("spinbutton");
expect(
screen.getByLabelText(
"Quantity of throughput at point of sale during compliance period [Jan 1 - Dec 31], if applicable",
),
).toHaveRole("spinbutton");
});
// render(await ProductionData({ facility_id: "abc", report_version_id: 1 }));
// expect(screen.getByText("testProduct")).toBeInTheDocument();
// expect(screen.getByText("Unit")).toBeInTheDocument();
// expect(screen.getByText("tonnes of tests")).toBeInTheDocument();
// expect(
// screen.getByLabelText("Production data for Apr 1 - Dec 31, 2024*"),
// ).toHaveRole("spinbutton");
// expect(
// screen.getByLabelText("Production Quantification Methodology*"),
// ).toHaveRole("textbox");
// expect(
// screen.getByLabelText(
// "Quantity in storage at the beginning of the compliance period [Jan 1], if applicable",
// ),
// ).toHaveRole("spinbutton");
// expect(
// screen.getByLabelText(
// "Quantity in storage at the end of the compliance period [Dec 31], if applicable",
// ),
// ).toHaveRole("spinbutton");
// expect(
// screen.getByLabelText(
// "Quantity sold during compliance period [Jan 1 - Dec 31], if applicable",
// ),
// ).toHaveRole("spinbutton");
// expect(
// screen.getByLabelText(
// "Quantity of throughput at point of sale during compliance period [Jan 1 - Dec 31], if applicable",
// ),
// ).toHaveRole("spinbutton");
// });
});

0 comments on commit 04b4afe

Please sign in to comment.