I've been following along Dan Abramov's Redux tutorial which can be found at ()
Lesson 9 covers testing and the usage of expect
and .toEqual()
This is the code I'm working on:
var expect = require('chai').expect;
var freeze = require('deep-freeze-node');
const testToggleTodo = () => {
const todoBefore = {
id: 0,
text: 'Learn Redux',
completed: false
};
const todoAfter = {
id: 0,
text: 'Learn Redux',
completed: true
};
expect(
toggleTodo(todoBefore)
).toEqual(todoAfter)
}
testToggleTodo();
console.log('All tests passed.')
But I keep encountering an error message:
.../react_redux/src/a.js:24
).toEqual(todoAfter)
^
TypeError: expect(...).toEqual is not a function
Can someone help me figure out what's wrong? I've double-checked the code against his but it's still throwing errors.