Skip to content

Commit 1765957

Browse files
authored
Update HealthChart.test.tsx
1 parent fbb4ecc commit 1765957

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

__tests__/charts/HealthChart.test.tsx

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import React from 'react';
22
import HealthChart from '../../app/charts/HealthChart';
33
import { render, screen } from '@testing-library/react';
44

5-
// import mockData from '../mock_data.json';
6-
5+
// mockData used for testing suite
76
const mockData = {
87
ServiceName: {
98
Metric: {
@@ -26,11 +25,7 @@ jest.mock('electron', () => ({
2625
},
2726
}));
2827

29-
// jest.mock('react-plotly.js', () => (props) {
30-
// const div = document.createElement('div');
31-
32-
// })
33-
28+
// test suite for HealthChart.tsx
3429
describe('HealthChart', () => {
3530
const props = {
3631
key: 'testKey',
@@ -63,39 +58,8 @@ describe('HealthChart', () => {
6358
expect(graph.scrollTop).toBe(0);
6459
});
6560

66-
// it('Should have width 800, height 600, and white background', () => {
67-
// // console.log('graph', graph.firstChild);
68-
// console.log('graph.outerHTML: ', graph.outerHTML);
69-
70-
// expect(graph.outerHTML.includes('width: 800px')).toBeTruthy();
71-
// expect(graph.outerHTML.includes('height: 600px')).toBeTruthy();
72-
// expect(graph.outerHTML.includes('style="background: white;"')).toBeTruthy();
73-
// });
74-
75-
// it('Should have correct colors', () => {
76-
// expect(graph.outerHTML.includes('{fill: #fc4039;}')).toBeTruthy();
77-
// });
78-
7961
it('Should have correct data on y-axis based off mock data', () => {
8062
expect(graph.data[0].y[0]).toBe((mockData.ServiceName.Metric.value[0] / 1000000).toFixed(2));
8163
expect(graph.data[0].y[1]).toBe((mockData.ServiceName.Metric.value[1] / 1000000).toFixed(2));
8264
});
83-
84-
// it('Should have correct time on x-axis based off mock data', () => {
85-
// const expectedOutput = ['15:18:25', '15:18:20', '15:18:15', '15:18:10', '15:18:05'];
86-
87-
// expect(graph.data[0].x[0]).toEqual(expectedOutput[0]);
88-
// expect(graph.data[0].x[1]).toEqual(expectedOutput[1]);
89-
// });
90-
91-
// it('Should have the correct service name on the graph', () => {
92-
// expect(graph).outerHTML.includes('title').toBe('ServiceName');
93-
// });
94-
95-
// describe('prettyTimeInReverse', () => {
96-
// test('Should reverse time and format properly', () => {
97-
// const result = HealthChart.prettyTimeInReverse(mockData.ServiceName.Metric.time);
98-
// expect(result).toEqual(expectedOutput);
99-
// });
100-
// });
10165
});

0 commit comments

Comments
 (0)