adding some redux steps

This commit is contained in:
Ken Chau
2019-02-16 17:00:47 -08:00
parent e143a0e820
commit 7fc326b0cb
22 changed files with 2096 additions and 2173 deletions

View File

@@ -0,0 +1,20 @@
import { addTodo } from './pureFunctions';
import { Store } from '../store';
describe('TodoApp reducers', () => {
it('can add an item', () => {
const state = <Store>{
todos: {},
filter: 'all'
};
const newState = addTodo(state, 'item1');
const keys = Object.keys(newState.todos);
expect(newState).not.toBe(state);
expect(keys.length).toBe(1);
expect(newState.todos[keys[0]].label).toBe('item1');
expect(newState.todos[keys[0]].completed).toBeFalsy();
});
});