| 
									
										
										
										
											2024-02-13 14:10:05 -08:00
										 |  |  | import { render } from "@testing-library/react-native"; | 
					
						
							|  |  |  | import React from "react"; | 
					
						
							| 
									
										
										
										
											2024-02-15 11:44:15 -08:00
										 |  |  | import BarGraph from "../../src/component/charts/bar-graph/bar-graph"; | 
					
						
							| 
									
										
										
										
											2024-02-13 14:10:05 -08:00
										 |  |  | import ChartContainer from "../../src/component/charts/container/chart-container"; | 
					
						
							|  |  |  | import LineGraph from "../../src/component/charts/line-graph/line-graph"; | 
					
						
							| 
									
										
										
										
											2024-02-15 11:44:15 -08:00
										 |  |  | import { | 
					
						
							|  |  |  | 	graph_data_two_measures, | 
					
						
							|  |  |  | 	line_chart_two_y_data, | 
					
						
							|  |  |  | } from "../mock/charts/mock-data"; | 
					
						
							| 
									
										
										
										
											2024-02-13 14:10:05 -08:00
										 |  |  | describe("ChartContainer Component Tests", () => { | 
					
						
							|  |  |  | 	it("renders correctly with data -- line graph", () => { | 
					
						
							|  |  |  | 		const { getByTestId } = render( | 
					
						
							|  |  |  | 			<ChartContainer | 
					
						
							|  |  |  | 				data={line_chart_two_y_data} | 
					
						
							|  |  |  | 				testID="1" | 
					
						
							|  |  |  | 				ChartComponent={LineGraph} | 
					
						
							|  |  |  | 			/>, | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		expect(getByTestId(`chart-container-1`)).toBeTruthy(); | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2024-02-15 11:44:15 -08:00
										 |  |  | 	it("renders correctly with data -- bar graph", () => { | 
					
						
							|  |  |  | 		const { getByTestId } = render( | 
					
						
							|  |  |  | 			<ChartContainer | 
					
						
							|  |  |  | 				data={graph_data_two_measures} | 
					
						
							|  |  |  | 				testID="1" | 
					
						
							|  |  |  | 				ChartComponent={BarGraph} | 
					
						
							|  |  |  | 			/>, | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		expect(getByTestId(`chart-container-1`)).toBeTruthy(); | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2024-02-13 14:10:05 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	it("does not render without data props", () => { | 
					
						
							|  |  |  | 		// Have to ts-ignore to test null data conditions
 | 
					
						
							|  |  |  | 		// @ts-ignore
 | 
					
						
							|  |  |  | 		const { queryByTestId } = render(<ChartContainer testID="2" />); | 
					
						
							|  |  |  | 		expect(queryByTestId(`chart-container-2`)).toBeNull(); | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | }); |