diff --git a/src/component/charts/container/chart-container.tsx b/src/component/charts/container/chart-container.tsx index 096405f..3b62f53 100644 --- a/src/component/charts/container/chart-container.tsx +++ b/src/component/charts/container/chart-container.tsx @@ -54,7 +54,7 @@ const ChartContainer: React.FC = ({ { + it("renders correctly with data -- line graph", () => { + const { getByTestId } = render( + , + ); + expect(getByTestId(`chart-container-1`)).toBeTruthy(); + }); + + it("does not render without data props", () => { + // Have to ts-ignore to test null data conditions + // @ts-ignore + const { queryByTestId } = render(); + expect(queryByTestId(`chart-container-2`)).toBeNull(); + }); +}); diff --git a/test/component/line-graph.test.tsx b/test/component/line-graph.test.tsx deleted file mode 100644 index 5c1e745..0000000 --- a/test/component/line-graph.test.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { render } from "@testing-library/react-native"; -import React from "react"; -import LineGraph from "../../src/component/charts/line-graph/line-graph"; -import { line_chart_two_y_data } from "../mock/charts/mock-data"; - -describe("LineGraph Component Tests", () => { - it("renders correctly with data", () => { - const { getByTestId } = render( - , - ); - 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(); - expect(queryByTestId(`line-graph-2`)).toBeNull(); - }); -}); diff --git a/test/mock/charts/mock-data.ts b/test/mock/charts/mock-data.ts index 94800a3..3a7e472 100644 --- a/test/mock/charts/mock-data.ts +++ b/test/mock/charts/mock-data.ts @@ -62,3 +62,38 @@ export const line_chart_two_y_data = { }, ], }; + +export const mockYData = [ + { + data: [ + { value: 71.42857142857143 }, + { value: 100 }, + { value: 64.28571428571429 }, + { value: 57.14285714285714 }, + { value: 28.57142857142857 }, + { value: 14.285714285714285 }, + { value: 50 }, + { value: 14.285714285714285 }, + { value: 21.428571428571427 }, + { value: 21.428571428571427 }, + ], + svg: { fill: "transparent", stroke: "#598EBB" }, + }, + { + data: [ + { value: 27.77777777777778 }, + { value: 37.22222222222222 }, + { value: 68.33333333333333 }, + { value: 77.77777777777779 }, + { value: 86.66666666666667 }, + { value: 81.66666666666667 }, + { value: 70 }, + { value: 100 }, + { value: 68.33333333333333 }, + { value: 48.333333333333336 }, + ], + svg: { fill: "transparent", stroke: "#F2D4BC" }, + }, +]; + +export const mockXValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];