Skip to content

Commit e848f7e

Browse files
committed
merge dev
2 parents 273d234 + ac15e5e commit e848f7e

36 files changed

+4989
-442
lines changed

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
node_modules
22
.DS_Store
3-
dist/
4-
extension/bundle.js
5-
package/react-time-travel-1.0.1.tgz
3+
src/extension/build/bundles
4+
package/react-time-travel-*.tgz
65
tictactoe
7-
tictactoe/build/bundle.js
8-
tictactoe/package-lock.json
96
parents
107
coverage

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ module.exports = {
1010
],
1111
['@babel/preset-react'],
1212
],
13+
plugins: [
14+
["@babel/plugin-proposal-decorators", { legacy: true }]
15+
]
1316
};

package-lock.json

Lines changed: 174 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"build": "webpack --mode production",
77
"dev": "webpack --mode development --watch",
8-
"test": "jest --verbose --coverage"
8+
"test": "jest --verbose --coverage --watchAll"
99
},
1010
"keywords": [
1111
"react",
@@ -26,6 +26,7 @@
2626
"@babel/core": "^7.5.5",
2727
"@babel/preset-env": "^7.5.5",
2828
"@babel/preset-react": "^7.0.0",
29+
"@babel/plugin-proposal-decorators": "^7.4.4",
2930
"babel-loader": "^8.0.6",
3031
"css-loader": "^3.1.0",
3132
"enzyme": "^3.10.0",
@@ -37,6 +38,7 @@
3738
"eslint-plugin-jsx-a11y": "^6.2.3",
3839
"eslint-plugin-react": "^7.14.2",
3940
"jest": "^24.8.0",
41+
"jest-cli": "^24.8.0",
4042
"node-sass": "^4.12.0",
4143
"sass-loader": "^7.1.0",
4244
"style-loader": "^0.23.1",

package/__tests__/index.test.js

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1+
import { shallow } from 'enzyme';
2+
13
const index = require('../index');
24

35
jest.mock('../timeJump');
46

5-
describe('unit testing for index.js', () => {
6-
test('index.js should be exporting the linkState and timeJump methods', () => {
7-
expect(typeof index.linkState).toBe('function');
8-
expect(typeof index.timeJump).toBe('function');
9-
});
10-
11-
test('index.js should be listening to the window for the jumpToSnap message', (done) => {
12-
const calls = 10;
13-
let count = 0;
14-
global.addEventListener('message', ({ data: { action } }) => {
15-
if (action === 'jumpToSnap') {
16-
count += 1;
17-
// timeJump should be called everytime a message is received
18-
expect(index.timeJump.mock.calls.length).toBe(count);
19-
20-
// test is done once all messages have been received
21-
if (count === calls) done();
22-
}
23-
});
24-
25-
// iterate ${calls} amount of times
26-
[...Array(calls).keys()].forEach(() => global.postMessage({ action: 'jumpToSnap', payload: ['test'] }, '*'));
27-
});
28-
});
7+
8+
// describe('unit testing for index.js', () => {
9+
// test('index.js should be exporting the linkState and timeJump methods', () => {
10+
// expect(typeof index.linkState).toBe('function');
11+
// expect(typeof index.timeJump).toBe('function');
12+
// });
13+
14+
// test('index.js should be listening to the window for the jumpToSnap message', (done) => {
15+
// const calls = 10;
16+
// let count = 0;
17+
// global.addEventListener('message', ({ data: { action } }) => {
18+
// if (action === 'jumpToSnap') {
19+
// count += 1;
20+
// // timeJump should be called everytime a message is received
21+
// expect(index.timeJump.mock.calls.length).toBe(count);
22+
23+
// // test is done once all messages have been received
24+
// if (count === calls) done();
25+
// }
26+
// });
27+
28+
// // iterate ${calls} amount of times
29+
// [...Array(calls).keys()].forEach(() => global.postMessage({ action: 'jumpToSnap', payload: ['test'] }, '*'));
30+
// });
31+
32+
// });

package/__tests__/timeJump.test.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import TestRenderer from 'react-test-renderer';
12
const timeJumpExport = require('../timeJump');
3+
import { shallow } from 'enzyme';
24

35
describe('unit testing for timeJump.js', () => {
46
let timeJump;
@@ -28,29 +30,31 @@ describe('unit testing for timeJump.js', () => {
2830
}
2931
});
3032

31-
test('calling the initial require should return a function', () => {
32-
expect(typeof timeJump).toBe('function');
33-
});
33+
// test('calling the initial require should return a function', () => {
34+
// expect(typeof timeJump).toBe('function');
35+
// });
3436

35-
test('timeJump should iterate through snapshot and call setStateAsync on each state', () => {
36-
const calls = 10;
37-
for (let i = 1; i <= calls; i += 1) {
38-
timeJump(Array(count).fill('test'));
39-
mockFuncs.forEach(mockFunc => expect(mockFunc.mock.calls.length).toBe(i));
40-
}
41-
});
42-
test('timeJump should pass the state from new snapshot to setStateAsync', () => {
43-
const newSnapShot = [];
44-
for (let i = 0; i < count; i += 1) {
45-
newSnapShot.push(`testState${i}`);
46-
}
47-
timeJump(newSnapShot);
48-
mockFuncs.forEach((mockFunc, i) => expect(mockFunc.mock.calls[0][0]).toBe(`testState${i}`));
37+
// test('timeJump should iterate through snapshot and call setStateAsync on each state', () => {
38+
// const calls = 10;
39+
// for (let i = 1; i <= calls; i += 1) {
40+
// timeJump(Array(count).fill('test'));
41+
// mockFuncs.forEach(mockFunc => expect(mockFunc.mock.calls.length).toBe(i));
42+
// }
43+
// });
44+
45+
// test('timeJump should pass the state from new snapshot to setStateAsync', () => {
46+
// const newSnapShot = [];
47+
// for (let i = 0; i < count; i += 1) {
48+
// newSnapShot.push(`testState${i}`);
49+
// }
50+
// timeJump(newSnapShot);
51+
// mockFuncs.forEach((mockFunc, i) => expect(mockFunc.mock.calls[0][0]).toBe(`testState${i}`));
52+
53+
// for (let i = 0; i < count; i += 1) {
54+
// newSnapShot[i] = { testkey: `testval${i}` };
55+
// }
56+
// timeJump(newSnapShot);
57+
// mockFuncs.forEach((mockFunc, i) => expect(mockFunc.mock.calls[1][0]).toEqual({ testkey: `testval${i}` }));
58+
// });
4959

50-
for (let i = 0; i < count; i += 1) {
51-
newSnapShot[i] = { testkey: `testval${i}` };
52-
}
53-
timeJump(newSnapShot);
54-
mockFuncs.forEach((mockFunc, i) => expect(mockFunc.mock.calls[1][0]).toEqual({ testkey: `testval${i}` }));
55-
});
5660
});

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ Then open up your Chrome DevTools. There'll be a new tab called React-Time-Trave
4141
## License
4242

4343
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
44+

0 commit comments

Comments
 (0)