railbird-gql/test/component/line-graph.test.tsx

21 lines
703 B
TypeScript
Raw Normal View History

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