add bar graph, make changes to customgrid and custombars to match new structure

This commit is contained in:
Loewy
2024-01-15 17:40:24 -08:00
parent 981b5cebca
commit aed0faebf0
10 changed files with 840 additions and 68 deletions

View File

@@ -0,0 +1,20 @@
import React from 'react';
import { render } from '@testing-library/react-native';
import BarGraph from '../../component/charts/bar-graph/bar-graph';
import { graph_data_two_measures } from '../../mock/charts/mock-data';
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();
});
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();
});
});

View File

@@ -29,8 +29,8 @@ describe('CustomBars Component Tests', () => {
x={mockXScaleFunction}
y={mockYScaleFunction}
bandwidth={mockBandwidth}
combinedData={mockCombinedData}
rawData={mockRawData}
barData={mockCombinedData}
xValues={mockRawData}
barColors={mockBarColors}
gap={mockGap}
roundedRadius={mockRoundedRadius}