Skip to content

Commit 9fccebf

Browse files
committed
buttons container tests all passing
1 parent e6680df commit 9fccebf

File tree

3 files changed

+17
-30
lines changed

3 files changed

+17
-30
lines changed

src/app/__tests__/ButtonContainer.test.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,14 @@ global.URL.revokeObjectURL = jest.fn();
138138

139139
describe('Unit testing for ButtonContainer', () => {
140140
const useDispatchMock = (useDispatch as unknown) as jest.Mock; // make the test run
141-
// const useDispatchMock = useDispatch as jest.Mock; //getting a reference to the mock function you setup during jest.mock configuration on line 18
142141
const dummyDispatch = jest.fn(); //separate mock function created because we need to explicitly define on line 30 what
143142
useDispatchMock.mockReturnValue(dummyDispatch); //exactly useDispatchMock returns (which is a jest.fn())
144143
beforeEach;
145144

146145
const currentTab = customInitialState.main.tabs[customInitialState.main.currentTab];
147146

148-
// const dispatch = jest.fn();
149-
// const exportHandler = jest.fn().mockImplementation(() => 'clicked');
150-
// const importHandler = jest.fn();
151-
// const fileDownload = jest.fn();
152-
153-
// mockedUsedStoreContext.mockImplementation(() => [state, dispatch]);
154-
// useStoreContext.mockImplementation(() => [state, dispatch]);
155-
156147
beforeEach(() => {
157-
// dispatch.mockClear();
158-
// mockedUsedStoreContext.mockClear();
148+
159149
currentTab.mode = {
160150
paused: true,
161151
};

src/app/__tests__/MainContainer.test.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ts-nocheck
21
import React from 'react';
32
import { render, screen } from '@testing-library/react';
43
import MainContainer from '../containers/MainContainer';
@@ -16,8 +15,6 @@ const mockState = {
1615
},
1716
}; // End
1817

19-
// const chrome = require('sinon-chrome');
20-
2118
const mockActionContainer = jest.fn();
2219
jest.mock('../containers/ActionContainer', () => (props) => {
2320
mockActionContainer(props);
@@ -55,17 +52,17 @@ jest.mock('../../../node_modules/intro.js/introjs.css', () => jest.fn());
5552
useDispatch.mockReturnValue(dispatch);
5653
useSelector.mockImplementation((callback) => callback(mockState));
5754

58-
// global.chrome = chrome;
59-
// const port = {
60-
// onMessage: {
61-
// addListener: () => {},
62-
// hasListener: () => {},
63-
// },
64-
// onDisconnect: {
65-
// addListener: () => {},
66-
// },
67-
// };
68-
// chrome.runtime.connect.returns(port);
55+
global.chrome = chrome;
56+
const port = {
57+
onMessage: {
58+
addListener: () => {},
59+
hasListener: () => {},
60+
},
61+
onDisconnect: {
62+
addListener: () => {},
63+
},
64+
};
65+
chrome.runtime.connect.returns(port);
6966

7067
describe('With no snapshots, should not render any containers', () => {
7168
test('With no snapshots, ErrorContainer should render', () => {

src/app/__tests__/Tutorial.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Before Tutorial is entered', () => {
2020
expect(screen.getByText('Tutorial')).toBeInTheDocument();
2121
});
2222

23-
xtest('User clicking tutorial button while on map tab starts map tutorial ', () => {
23+
test('User clicking tutorial button while on map tab starts map tutorial ', () => {
2424
props.currentTabInApp = 'map';
2525
render(<Tutorial {...props} />);
2626
fireEvent.click(screen.getByRole('button'));
@@ -29,28 +29,28 @@ describe('Before Tutorial is entered', () => {
2929
).toBeInTheDocument();
3030
});
3131

32-
xtest('User clicking tutorial button while on performance tab starts performance tutorial ', () => {
32+
test('User clicking tutorial button while on performance tab starts performance tutorial ', () => {
3333
props.currentTabInApp = 'performance';
3434
render(<Tutorial {...props} />);
3535
fireEvent.click(screen.getByRole('button'));
3636
expect(screen.getByText('Performance Tab')).toBeInTheDocument();
3737
});
3838

39-
xtest('User clicking tutorial button while on history tab starts history tutorial ', () => {
39+
test('User clicking tutorial button while on history tab starts history tutorial ', () => {
4040
props.currentTabInApp = 'history';
4141
render(<Tutorial {...props} />);
4242
fireEvent.click(screen.getByRole('button'));
4343
expect(screen.getByText('History Tab')).toBeInTheDocument();
4444
});
4545

46-
xtest('User clicking tutorial button while on web metrics tab starts web metrics tutorial ', () => {
46+
test('User clicking tutorial button while on web metrics tab starts web metrics tutorial ', () => {
4747
props.currentTabInApp = 'webmetrics';
4848
render(<Tutorial {...props} />);
4949
fireEvent.click(screen.getByRole('button'));
5050
expect(screen.getByText('Webmetrics Tab')).toBeInTheDocument();
5151
});
5252

53-
xtest('User clicking tutorial button while on tree tab starts tree tutorial ', () => {
53+
test('User clicking tutorial button while on tree tab starts tree tutorial ', () => {
5454
props.currentTabInApp = 'tree';
5555
render(<Tutorial {...props} />);
5656
fireEvent.click(screen.getByRole('button'));

0 commit comments

Comments
 (0)