Skip to content

Instantly share code, notes, and snippets.

@bradfordlemley
Last active May 29, 2019 21:06
Show Gist options
  • Save bradfordlemley/8be1905b53778b84247ca4dfbca0d7a6 to your computer and use it in GitHub Desktop.
Save bradfordlemley/8be1905b53778b84247ca4dfbca0d7a6 to your computer and use it in GitHub Desktop.
Todo library test
test("Adds todos", () => {
const todoLib = createTodoLib();
todoLib.addTodo("First todo");
expect(todoLib.state.todos).toHaveLength(1);
expect(todoLib.state.activeTodos).toHaveLength(1);
expect(todoLib.state.completedTodos).toHaveLength(0);
todoLib.addTodo("Second Todo");
expect(todoLib.state.todos).toHaveLength(2);
expect(todoLib.state.activeTodos).toHaveLength(2);
expect(todoLib.state.completedTodos).toHaveLength(0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment