added jest and a new test
This commit is contained in:
Родитель
23aa611fea
Коммит
260b6177fe
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node'
|
||||
};
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -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",
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче