Skip to content

Commit f34b73d

Browse files
committed
Merge branch 'rydang/actiontest' into rydang/maincontainer
2 parents 422f537 + 1d9e31a commit f34b73d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/app/__tests__/dropdown.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('unit testing for Dropdown.jsx', () => {
1515
{ value: 23, label: '2.0x' },
1616
],
1717
setSpeed: jest.fn(),
18-
selectedOption: { value: 312, label: '1.0x' },
18+
selectedSpeed: { value: 312, label: '1.0x' },
1919
};
2020
beforeEach(() => {
2121
wrapper = shallow(<Dropdown {...props} />);
@@ -30,8 +30,8 @@ describe('unit testing for Dropdown.jsx', () => {
3030
});
3131
});
3232

33-
describe('handlechangeSpeed', () => {
34-
test('should invoke handleChangeSpeed onChange', () => {
33+
describe('setSpeed', () => {
34+
test('should invoke setSpeed on change', () => {
3535
wrapper.simulate('change', { value: 2000, label: '0.5x' });
3636
expect(props.setSpeed).toHaveBeenCalled();
3737
});

src/app/containers/MainContainer.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import HeadContainer from './HeadContainer';
33
import ActionContainer from './ActionContainer';
44
import StateContainer from './StateContainer';
@@ -10,9 +10,8 @@ import {
1010
} from '../actions/actions';
1111
import { useStoreContext } from '../store';
1212

13-
let npmPackageExists = false;
14-
1513
function MainContainer() {
14+
const [npmExists, setnpm] = useState(false);
1615
const [store, dispatch] = useStoreContext();
1716
const { tabs, currentTab, port: currentPort } = store;
1817

@@ -33,8 +32,8 @@ function MainContainer() {
3332
break;
3433
}
3534
case 'initialConnectSnapshots': {
36-
npmPackageExists = true;
3735
dispatch(initialConnect(payload));
36+
setnpm(true);
3837
break;
3938
}
4039
default:
@@ -49,7 +48,7 @@ function MainContainer() {
4948
dispatch(setPort(port));
5049
});
5150

52-
if (!npmPackageExists) return <div style={{ color: 'black' }}>please install our npm package in your app</div>;
51+
if (!npmExists) return <div style={{ color: 'black' }}>please install our npm package in your app</div>;
5352

5453
const { viewIndex, sliderIndex, snapshots } = tabs[currentTab];
5554

0 commit comments

Comments
 (0)