2024-02-03 20:23:31 -07:00
|
|
|
import { render } from "@testing-library/react-native";
|
2024-02-03 20:30:00 -07:00
|
|
|
import React from "react";
|
2024-02-06 15:24:49 -07:00
|
|
|
import BarGraph from "../../src/component/charts/bar-graph/bar-graph";
|
2024-02-06 16:08:19 -07:00
|
|
|
import { graph_data_two_measures } from "../mock/charts/mock-data";
|
2024-01-15 18:40:24 -07:00
|
|
|
|
2024-02-03 20:23:31 -07:00
|
|
|
describe("BarGraph Component Tests", () => {
|
|
|
|
it("renders correctly with data", () => {
|
|
|
|
const { getByTestId } = render(
|
|
|
|
<BarGraph data={graph_data_two_measures} testID="1" />,
|
|
|
|
);
|
|
|
|
expect(getByTestId(`bar-graph-1`)).toBeTruthy();
|
|
|
|
});
|
2024-01-15 18:40:24 -07:00
|
|
|
|
2024-02-03 20:23:31 -07:00
|
|
|
it("does not render without data", () => {
|
|
|
|
// Have to ts-ignore to test null data conditions
|
|
|
|
// @ts-ignore
|
|
|
|
const { queryByTestId } = render(<BarGraph testID="2" />);
|
|
|
|
expect(queryByTestId(`bar-graph-2`)).toBeNull();
|
|
|
|
});
|
2024-01-15 18:40:24 -07:00
|
|
|
});
|