Skip to content

Commit 895af50

Browse files
author
Jeffrey Na
committed
Merge branch 'dev' into jeff
2 parents 8defd8c + 6332ab3 commit 895af50

File tree

7 files changed

+6
-177
lines changed

7 files changed

+6
-177
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
});

__tests__/charts/TrafficChart.test.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ describe('Traffic Chart', () => {
6565
expect(graph._fullLayout.height).toBe(300);
6666
});
6767

68-
// it('Should have correct colors', () => {
69-
// expect(graph.outerHTML.includes('{fill: #3f4f75;}')).toBeTruthy();
70-
// expect(graph.outerHTML.includes('{fill: #80cfbe;}')).toBeTruthy();
71-
// expect(graph.outerHTML.includes('{fill: #fff;}')).toBeTruthy();
72-
// });
73-
7468
it('Should have correct data points based off mock data', () => {
7569
expect(graph.calcdata[0][0].isBlank).toBeFalsy();
7670
expect(graph.data[0].x).toEqual(['customers']);

__tests__/components/AwaitingApproval.test.tsx

Lines changed: 0 additions & 42 deletions
This file was deleted.

__tests__/components/FirstLaunch.test.tsx

Lines changed: 0 additions & 40 deletions
This file was deleted.

__tests__/components/Login.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jest.mock('react-router-dom', () => ({
1313
...jest.requireActual('react-router-dom'),
1414
useNavigate: () => navigateMock,
1515
}));
16-
// const mock = jest.fn(Electron.ipcRenderer.sendSync())
1716

17+
// testing suite for the CreateAdmin.tsx file
1818
describe('Create Admin Page', () => {
1919
beforeEach(() => {
2020
render(

__tests__/components/SignUp.test.tsx

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { HashRouter as Router } from 'react-router-dom';
77

88
jest.mock('electron', () => ({ ipcRenderer: { sendSync: jest.fn() } }));
99

10-
describe('Create Admin Page', () => {
10+
describe('Create Signup Page', () => {
1111
beforeEach(() => {
1212
render(
1313
<Router>
@@ -43,35 +43,5 @@ describe('Create Admin Page', () => {
4343
fireEvent.change(username, { target: { value: 'me' } });
4444
fireEvent.change(password, { target: { value: 'me123' } });
4545
fireEvent.click(signupButton);
46-
47-
// expect(ipcRenderer.sendSync).toHaveBeenCalledTimes(1);
48-
// expect(ipcRenderer.sendSync).toHaveBeenCalledWith('addUser', {
49-
// username: 'me',
50-
// email: '[email protected]',
51-
// password: 'me123',
52-
// });
5346
});
5447
});
55-
56-
// describe('handle submit function', () => {
57-
// beforeEach(() => {
58-
// render(
59-
// <Router>
60-
// <DashboardContextProvider>
61-
// <SignUp />
62-
// </DashboardContextProvider>
63-
// </Router>
64-
// );
65-
// });
66-
67-
// it('should show error message when passwords don\'t match', () => {
68-
// const element = screen.getByTestId('SignUp');
69-
// const inputs = element.querySelectorAll('input');
70-
// inputs[0].value = 'me';
71-
// inputs[1].value = '[email protected]';
72-
// inputs[2].value = 'me123';
73-
// inputs[3].value = 'me1234';
74-
// fireEvent.submit(element);
75-
// expect(screen.getByText('Entered passwords do not match')).toBeInTheDocument();
76-
// })
77-
// })

jest.config.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
import type { Config } from '@jest/types';
22

3-
// module.exports = {
4-
// verbose: true,
5-
// setupFilesAfterEnv: ['./jest_setup/windowMock.js'],
6-
// testEnvironment: "jsdom",
7-
// preset: 'ts-jest/presets/js-with-ts',
8-
// moduleNameMapper: {
9-
// '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
10-
// '<rootDir>/jest_setup/fileMock.js',
11-
// '\\.(css|less|scss)$': '<rootDir>/jest_setup/styleMock.js',
12-
// },
13-
// collectCoverage: true,
14-
// // types: ["jest","node"],
15-
// };
16-
17-
// Convert to TypeScript
18-
// Note: Configuring Jest to TypeScript following the docs seemed incorrect?
19-
// @jest/types is an npm package to use to create a typed Jest config
20-
3+
// describes the jest testing configuration for all test files
214
const config: Config.InitialOptions = {
225
verbose: true,
236
setupFilesAfterEnv: ['./jest_setup/windowMock.js'],
@@ -32,4 +15,4 @@ const config: Config.InitialOptions = {
3215
collectCoverage: true,
3316
};
3417

35-
export default config;
18+
export default config;

0 commit comments

Comments
 (0)