@@ -2,8 +2,7 @@ import React from 'react';
2
2
import HealthChart from '../../app/charts/HealthChart' ;
3
3
import { render , screen } from '@testing-library/react' ;
4
4
5
- // import mockData from '../mock_data.json';
6
-
5
+ // mockData used for testing suite
7
6
const mockData = {
8
7
ServiceName : {
9
8
Metric : {
@@ -26,11 +25,7 @@ jest.mock('electron', () => ({
26
25
} ,
27
26
} ) ) ;
28
27
29
- // jest.mock('react-plotly.js', () => (props) {
30
- // const div = document.createElement('div');
31
-
32
- // })
33
-
28
+ // test suite for HealthChart.tsx
34
29
describe ( 'HealthChart' , ( ) => {
35
30
const props = {
36
31
key : 'testKey' ,
@@ -63,39 +58,8 @@ describe('HealthChart', () => {
63
58
expect ( graph . scrollTop ) . toBe ( 0 ) ;
64
59
} ) ;
65
60
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
-
79
61
it ( 'Should have correct data on y-axis based off mock data' , ( ) => {
80
62
expect ( graph . data [ 0 ] . y [ 0 ] ) . toBe ( ( mockData . ServiceName . Metric . value [ 0 ] / 1000000 ) . toFixed ( 2 ) ) ;
81
63
expect ( graph . data [ 0 ] . y [ 1 ] ) . toBe ( ( mockData . ServiceName . Metric . value [ 1 ] / 1000000 ) . toFixed ( 2 ) ) ;
82
64
} ) ;
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
- // });
101
65
} ) ;
0 commit comments