- Let's say we are implementing a Jest test and we have a variable called result, which we want to check isn't null. How can we do this with Jest matcher functions?
expect(result).not.toBeNull()
- Let's say we have variable called person that is of type IPerson:
interface IPerson {
id: number;
name: string;
}
We want to check that the person variable is { id: 1, name: "bob" }. How can we do this with Jest matcher functions?
expect(person).not.toBeEqual({ id: 1, name: "bob" });
- Is it possible to carry out our check in the last question with a Jest snapshot test? If so how?
Yes:
expect(person).toMatchSnapshot();
- We have implemented a component called CheckList, which renders text from an array in a list. Each list item has a checkbox so that the user can select list items. The component has a function prop...