Skip to content

Commit 49d7d46

Browse files
committed
Added test cases to PieChartInfoDetail
1 parent bc6b644 commit 49d7d46

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/components/Reports/TeamReport/components/__tests__/PieChartInfoDetail.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,32 @@ describe('PieChartInfoDetail Component', () => {
2121
const legendSquare = container.querySelector('.pie-chart-legend-color-square');
2222
expect(legendSquare).toHaveStyle('background-color: #ff0000');
2323
});
24+
25+
test('test_render_keyName_and_value_with_darkMode', () => {
26+
const { getByText } = render(<PieChartInfoDetail keyName="Test Key" value="123" color="#000000" darkMode={true} />);
27+
expect(getByText('Test Key')).toBeInTheDocument();
28+
expect(getByText('123')).toBeInTheDocument();
29+
expect(getByText('Test Key')).toHaveClass('text-light');
30+
expect(getByText('123')).toHaveClass('text-light');
31+
});
32+
33+
test('test_render_with_specific_margin_styles', () => {
34+
const { getByText } = render(<PieChartInfoDetail keyName="Test Key" value="123" color="#000000" darkMode={false} />);
35+
const valueElement = getByText('123');
36+
expect(valueElement).toHaveStyle('margin-top: 16px');
37+
expect(valueElement).toHaveStyle('margin-left: 120px');
38+
});
39+
40+
test('test_render_with_different_color_and_darkMode_combinations', () => {
41+
const { getByText } = render(<PieChartInfoDetail keyName="Test Key" value="123" color="#00ff00" darkMode={true} />);
42+
expect(getByText('Test Key')).toBeInTheDocument();
43+
expect(getByText('123')).toBeInTheDocument();
44+
expect(getByText('Test Key')).toHaveClass('text-light');
45+
expect(getByText('123')).toHaveClass('text-light');
46+
});
47+
48+
test('test_apply_special_key_class_when_keyName_is_Special', () => {
49+
const { getByText } = render(<PieChartInfoDetail keyName="Special" value="123" color="#000000" darkMode={false} />);
50+
expect(getByText('Special')).toHaveClass('pie-chart-info-key');
51+
});
2452
});

0 commit comments

Comments
 (0)