Skip to content

Commit 9d67afd

Browse files
Update jest.md
1 parent 18ae688 commit 9d67afd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

recipes/javascript/tests/jest.md

+14
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,17 @@ Based on the file generated when adding the [Vue Jest plugin](https://cli.vuejs.
108108
});
109109
});
110110
```
111+
112+
## Expect
113+
114+
See [Expect](https://jestjs.io/docs/en/expect.html) page of the docs.
115+
116+
### Error
117+
118+
Expect a function call to throw an error. Make sure to pass an anonymous function.
119+
120+
```javascript
121+
test('throws on octopus', () => {
122+
expect(() => drinkFlavor('octopus')).toThrow();
123+
});
124+
```

0 commit comments

Comments
 (0)