merge chart-view from master, implement in component
This commit is contained in:
31
test/component/chart-view.test.tsx
Normal file
31
test/component/chart-view.test.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
import { Text } from 'react-native'
|
||||
import { render } from '@testing-library/react-native';
|
||||
import "@testing-library/jest-native/extend-expect";
|
||||
|
||||
import ChartView from '../../component/charts/chart-view';
|
||||
|
||||
describe('ChartView Component Tests', () => {
|
||||
it('applies the passed style prop correctly', () => {
|
||||
const testStyle = { backgroundColor: 'blue', padding: 10 };
|
||||
const { getByTestId } = render(
|
||||
<ChartView style={testStyle} testID="chart-view">
|
||||
<Text>Test Child</Text>
|
||||
</ChartView>
|
||||
);
|
||||
|
||||
const chartView = getByTestId('chart-view');
|
||||
expect(chartView.props.style).toEqual(expect.arrayContaining([testStyle]));
|
||||
});
|
||||
|
||||
it('renders children correctly', () => {
|
||||
const { getByText } = render(
|
||||
<ChartView>
|
||||
<Text testID="child-text">Child Component</Text>
|
||||
</ChartView>
|
||||
);
|
||||
|
||||
const childText = getByText('Child Component');
|
||||
expect(childText).toBeTruthy();
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user