mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
added jest and a new test
This commit is contained in:
4
jest.config.js
Normal file
4
jest.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node'
|
||||
};
|
||||
3465
package-lock.json
generated
3465
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,17 +5,21 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "webpack-dev-server --mode development --progress",
|
||||
"build": "webpack --mode production"
|
||||
"build": "webpack --mode production",
|
||||
"test": "jest --watch"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^23.3.13",
|
||||
"@types/react": "^16.7.20",
|
||||
"@types/react-dom": "^16.0.11",
|
||||
"@types/redux": "^3.6.0",
|
||||
"@types/react-redux": "^7.0.0",
|
||||
"@types/redux": "^3.6.0",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"jest": "^23.6.0",
|
||||
"ts-jest": "^23.10.5",
|
||||
"ts-loader": "^5.3.3",
|
||||
"typescript": "^3.2.4",
|
||||
"webpack": "^4.28.4",
|
||||
|
||||
10
playground/src/reducers/__tests__/reducers.spec.ts
Normal file
10
playground/src/reducers/__tests__/reducers.spec.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { reducer } from '../index';
|
||||
|
||||
describe('reducers', () => {
|
||||
it('should add item to the list', () => {
|
||||
const newStore = reducer({ todos: {}, filter: 'all' }, { type: 'add', label: 'hello' });
|
||||
const keys = Object.keys(newStore.todos);
|
||||
expect(keys.length).toBe(1);
|
||||
expect(newStore.todos[keys[0]].label).toBe('hello');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user