Skip to content

Commit dfa5928

Browse files
committed
Merge branch 'dev' into bryan/diff
2 parents 43fad18 + 7bce3c3 commit dfa5928

File tree

5 files changed

+41
-63
lines changed

5 files changed

+41
-63
lines changed

babel.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ module.exports = {
88
},
99
},
1010
],
11-
['@babel/preset-react'],
11+
'@babel/preset-react',
1212
],
13-
plugins: [
14-
["@babel/plugin-proposal-decorators", { legacy: true }]
15-
]
1613
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"dev": "webpack --mode development --watch",
88
"test": "jest --verbose --coverage --watchAll",
99
"lint": "eslint --ext .js --ext .jsx src",
10-
"docker-build": "docker build -t reacttt/test-lint"
10+
"docker-build": "docker build -t reacttt/test-lint .",
11+
"docker-check": "docker-compose up --abort-on-container-exit"
1112
},
1213
"keywords": [
1314
"react",

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Two parts are needed for this tool to function. The chrome extension must be ins
1212
```
1313
npm i react-time-travel
1414
```
15-
3. Call the `linkFiber` method on your root container after rendering your App.
15+
3. Call the library method on your root container after rendering your App.
1616

1717
```
18-
const { linkFiber } = require('react-time-travel');
18+
const reactTimeTravel = require('react-time-travel');
1919
2020
const rootContainer = document.getElementById('root');
2121
ReactDom.render(<App />, rootContainer);
2222
23-
linkFiber(rootContainer);
23+
reactTimeTravel(rootContainer);
2424
```
2525

2626
4. Done! That's all you have to do to link your React project to our library.

src/app/__tests__/StateContainer.test.js

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,50 @@
11
/* eslint-disable react/jsx-filename-extension */
22

3-
import { shallow, configure } from 'enzyme';
3+
import { shallow, mount, configure } from 'enzyme';
44
import React from 'react';
55
import Adapter from 'enzyme-adapter-react-16';
66
import ActionContainer from '../containers/ActionContainer';
7-
7+
import { useStoreContext } from '../store';
8+
import { emptySnapshots } from '../actions/actions';
9+
import Action from '../components/Action';
810

911
configure({ adapter: new Adapter() });
1012

11-
const props = {
12-
snapshots: [],
13-
snapshotIndex: 1,
14-
handleChangeSnapshot: jest.fn(),
15-
handleJumpSnapshot: jest.fn(),
16-
emptySnapshot: jest.fn(),
13+
const state = {
14+
tabs: {
15+
87: {
16+
snapshots: [1,2,3,4],
17+
sliderIndex: 0,
18+
viewIndex: -1,
19+
},
20+
},
21+
currentTab: 87,
1722
};
1823

24+
const dispatch = jest.fn();
1925

20-
describe('testing the emptySnapshot button', () => {
21-
test.skip('emptySnapshot button should be called', () => {
22-
const wrapper = shallow((<ActionContainer {...props} />));
26+
jest.mock('../store');
27+
useStoreContext.mockImplementation(() => [state, dispatch]);
2328

24-
wrapper.find('.empty-button').simulate('click');
29+
let wrapper;
2530

26-
expect(props.emptySnapshot).toHaveBeenCalled();
31+
beforeEach(() => {
32+
wrapper = shallow(<ActionContainer />);
33+
useStoreContext.mockClear();
34+
dispatch.mockClear();
35+
});
36+
37+
describe('testing the emptySnapshot button', () => {
38+
test('emptySnapshot button should dispatch action upon click', () => {
39+
wrapper.find('.empty-button').simulate('click');
40+
expect(dispatch.mock.calls.length).toBe(1);
41+
});
42+
test('emptying snapshots should send emptySnapshot action to dispatch', () => {
43+
wrapper.find('.empty-button').simulate('click');
44+
expect(dispatch.mock.calls[0][0]).toEqual(emptySnapshots());
2745
});
2846
});
47+
48+
test('number of actions should reflect snapshots array', () => {
49+
expect(wrapper.find(Action).length).toBe(state.tabs[state.currentTab].snapshots.length);
50+
});

0 commit comments

Comments
 (0)