Skip to content

Commit e1e6049

Browse files
authored
Merge pull request #23 from oslabs-beta/testing-cleanup
Testing cleanup
2 parents ad5e3c5 + d7d7b0f commit e1e6049

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

src/app/__tests__/ActionContainer.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ describe('unit testing for ActionContainer', () => {
144144
expect(screen.getByText('MockSwitchApp')).toBeInTheDocument();
145145
});
146146

147-
test('Click works on clear button', async () => {
147+
test('Click works on clear button', () => {
148148
fireEvent.click(screen.getAllByRole('button')[0]);
149-
await expect(dispatch).toHaveBeenCalledTimes(1);
149+
expect(dispatch).toHaveBeenCalledTimes(1);
150150
});
151151
});
152152

src/app/__tests__/ButtonContainer.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Unit testing for ButtonContainer', () => {
5151
});
5252

5353
describe('When button container is loaded', () => {
54-
test('should have 4 buttons ', () => {
54+
test('it should have 4 buttons', () => {
5555
render(<ButtonsContainer />);
5656
expect(screen.getAllByRole('button')).toHaveLength(4);
5757
expect(screen.getAllByRole('button')[0]).toHaveTextContent('Locked');

src/app/__tests__/ErrorMsg.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ const props = {
1313
launchContent: null,
1414
};
1515

16-
const parseError = jest.fn();
17-
1816
describe('unit testing for ErrorContainer.tsx', () => {
1917
describe('When there are no errors', () => {
2018
test('Returns empty div', () => {
@@ -34,7 +32,7 @@ describe('unit testing for ErrorContainer.tsx', () => {
3432
});
3533
});
3634

37-
describe("when there's a Content Script Errorr", () => {
35+
describe("when there's a Content Script Error", () => {
3836
test('Content Script Error related text shows', () => {
3937
props.status.contentScriptLaunched = false;
4038
render(<ErrorMsg {...props} />);

src/app/__tests__/MainContainer.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ jest.mock('../containers/TravelContainer', () => (props) => {
2323
mockTravelContainer(props);
2424
return <div>mockTravelContainer</div>;
2525
});
26+
2627
const mockButtonsContainer = jest.fn();
2728
jest.mock('../containers/ButtonsContainer', () => (props) => {
2829
mockButtonsContainer(props);
2930
return <div>mockButtonsContainer</div>;
3031
});
32+
3133
const mockErrorContainer = jest.fn();
3234
jest.mock('../containers/ErrorContainer', () => (props) => {
3335
mockErrorContainer(props);

src/app/__tests__/MainSlider.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { render, screen, fireEvent } from '@testing-library/react';
2+
import { render, screen } from '@testing-library/react';
33
import '@testing-library/jest-dom/extend-expect';
44
import { TextEncoder } from 'util';
55
global.TextEncoder = TextEncoder;

src/app/__tests__/TravelContainer.test.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const state = {
1515
currentTab: 87,
1616
};
1717

18-
const play = jest.fn();
1918
const dispatch = jest.fn();
2019

2120
jest.mock('../store');
@@ -48,6 +47,7 @@ describe('All elements appear in the TravelContainer module', () => {
4847
test('MainSlider exists in document', () => {
4948
expect(screen.getByText('MockSlider')).toBeInTheDocument();
5049
});
50+
5151
test('Dropdown exists in document', () => {
5252
expect(screen.getByText('mockDropDown')).toBeInTheDocument();
5353
});
@@ -57,7 +57,7 @@ describe('All elements appear in the TravelContainer module', () => {
5757
expect(buttons[1]).toHaveTextContent('<');
5858
});
5959

60-
test('Foward button exists in document', () => {
60+
test('Forward button exists in document', () => {
6161
let buttons = screen.getAllByRole('button');
6262
expect(buttons[2]).toHaveTextContent('>');
6363
});
@@ -69,18 +69,18 @@ describe('Testing backward and forward button', () => {
6969
render(<TravelContainer snapshotsLength={0} />);
7070
});
7171

72-
test('Clicking < Button button will triger button', async () => {
72+
test('Clicking < Button button will trigger button', () => {
7373
let buttons = screen.getAllByRole('button');
7474
expect(buttons[1]).toHaveTextContent('<');
7575
fireEvent.click(buttons[1]);
76-
await expect(dispatch).toHaveBeenCalledTimes(1);
76+
expect(dispatch).toHaveBeenCalledTimes(1);
7777
});
7878

79-
test('Clicking > Button button will triger button', async () => {
79+
test('Clicking > Button button will trigger button', () => {
8080
let buttons = screen.getAllByRole('button');
8181
expect(buttons[2]).toHaveTextContent('>');
8282
fireEvent.click(buttons[2]);
83-
await expect(dispatch).toHaveBeenCalledTimes(1);
83+
expect(dispatch).toHaveBeenCalledTimes(1);
8484
});
8585
});
8686

@@ -94,33 +94,34 @@ describe('Testing play/pause button', () => {
9494
const playButton = screen.getByTestId('play-button-test');
9595
expect(playButton).toBeInTheDocument();
9696
});
97+
9798
test('Play initially says Play', () => {
9899
render(<TravelContainer snapshotsLength={0} />);
99100
const playButton = screen.getByTestId('play-button-test');
100101
expect(playButton.textContent).toBe('Play');
101102
});
102103

103-
test('Clicking Play button will triger button', async () => {
104+
test('Clicking Play button will trigger button', () => {
104105
render(<TravelContainer snapshotsLength={0} />);
105106
const playButton = screen.getByTestId('play-button-test');
106107
expect(playButton.textContent).toBe('Play');
107108
fireEvent.click(playButton);
108-
await expect(dispatch).toHaveBeenCalledTimes(1);
109+
expect(dispatch).toHaveBeenCalledTimes(1);
109110
});
110111

111-
test('Play says Pause when `Playing` is set to False', () => {
112+
test('Play says Pause when `Playing` is set to true', () => {
112113
state.tabs[87].playing = true;
113114
render(<TravelContainer snapshotsLength={0} />);
114115
const playButton = screen.getByTestId('play-button-test');
115116
expect(playButton.textContent).toBe('Pause');
116117
});
117118

118-
test('Clicking Pause button will trigger button', async () => {
119+
test('Clicking Pause button will trigger button', () => {
119120
render(<TravelContainer snapshotsLength={0} />);
120121
const playButton = screen.getByTestId('play-button-test');
121122
expect(playButton.textContent).toBe('Pause');
122123
fireEvent.click(playButton);
123-
await expect(dispatch).toHaveBeenCalledTimes(1);
124+
expect(dispatch).toHaveBeenCalledTimes(1);
124125
state.tabs[87].playing = false;
125126
});
126127
});

src/app/__tests__/Tutorial.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ describe('Before Tutorial is entered', () => {
2323

2424
test('User clicking tutorial button while on map tab starts map tutorial ', () => {
2525
props.currentTabInApp = 'map';
26-
2726
render(<Tutorial {...props} />);
2827
fireEvent.click(screen.getByRole('button'));
2928
expect(
30-
screen.getByText('A performance and state managment tool for React apps.'),
29+
screen.getByText('A performance and state management tool for React apps.'),
3130
).toBeInTheDocument();
3231
});
3332

src/app/__tests__/action.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('unit testing for Action.tsx', () => {
5454
expect(screen.getByPlaceholderText('Snapshot: 3.0')).toBeInTheDocument();
5555
});
5656

57-
test("when there's no have no duration data", () => {
57+
test("when there's no duration data", () => {
5858
props.componentData = undefined;
5959
render(<Action {...props} />);
6060
expect(screen.getAllByRole('button')[0]).toHaveTextContent('NO TIME');

src/app/components/Tutorial.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default class Tutorial extends Component<TutorialProps, TutorialState> {
8282
steps = [
8383
{
8484
title: 'Reactime Tutorial',
85-
intro: 'A performance and state managment tool for React apps.',
85+
intro: 'A performance and state management tool for React apps.',
8686
position: 'top',
8787
},
8888
{

0 commit comments

Comments
 (0)