Skip to content

Commit 05b8382

Browse files
gugrjeysal
authored andcommitted
Place "Note" directly after function title (#8391)
* Place "Note" directly after function title * Placed "Note" in .toThrow() section after first code block
1 parent 4c3c712 commit 05b8382

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

docs/ExpectAPI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,8 @@ test('throws on octopus', () => {
11821182
});
11831183
```
11841184

1185+
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
1186+
11851187
You can provide an optional argument to test that a specific error is thrown:
11861188

11871189
- regular expression: error message **matches** the pattern
@@ -1221,8 +1223,6 @@ test('throws on octopus', () => {
12211223
});
12221224
```
12231225

1224-
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
1225-
12261226
### `.toThrowErrorMatchingSnapshot(hint?)`
12271227

12281228
Use `.toThrowErrorMatchingSnapshot` to test that a function throws an error matching the most recent snapshot when it is called.

website/versioned_docs/version-22.x/ExpectAPI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,8 @@ test('throws on octopus', () => {
877877
});
878878
```
879879

880+
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
881+
880882
If you want to test that a specific error gets thrown, you can provide an argument to `toThrow`. The argument can be a string that should be contained in the error message, a class for the error, or a regex that should match the error message. For example, let's say that `drinkFlavor` is coded like this:
881883

882884
```js
@@ -908,8 +910,6 @@ test('throws on octopus', () => {
908910
});
909911
```
910912

911-
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
912-
913913
### `.toThrowErrorMatchingSnapshot()`
914914

915915
Use `.toThrowErrorMatchingSnapshot` to test that a function throws an error matching the most recent snapshot when it is called. For example, let's say you have a `drinkFlavor` function that throws whenever the flavor is `'octopus'`, and is coded like this:

website/versioned_docs/version-23.x/ExpectAPI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,8 @@ test('throws on octopus', () => {
11731173
});
11741174
```
11751175

1176+
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
1177+
11761178
If you want to test that a specific error gets thrown, you can provide an argument to `toThrow`. The argument can be a string that should be contained in the error message, a class for the error, or a regex that should match the error message. For example, let's say that `drinkFlavor` is coded like this:
11771179

11781180
```js
@@ -1204,8 +1206,6 @@ test('throws on octopus', () => {
12041206
});
12051207
```
12061208

1207-
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
1208-
12091209
### `.toThrowErrorMatchingSnapshot()`
12101210

12111211
Use `.toThrowErrorMatchingSnapshot` to test that a function throws an error matching the most recent snapshot when it is called. For example, let's say you have a `drinkFlavor` function that throws whenever the flavor is `'octopus'`, and is coded like this:

website/versioned_docs/version-24.0/ExpectAPI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,8 @@ test('throws on octopus', () => {
11891189
});
11901190
```
11911191

1192+
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
1193+
11921194
You can provide an optional argument to test that a specific error is thrown:
11931195

11941196
- regular expression: error message **matches** the pattern
@@ -1228,8 +1230,6 @@ test('throws on octopus', () => {
12281230
});
12291231
```
12301232

1231-
> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
1232-
12331233
### `.toThrowErrorMatchingSnapshot(hint?)`
12341234

12351235
Use `.toThrowErrorMatchingSnapshot` to test that a function throws an error matching the most recent snapshot when it is called.

0 commit comments

Comments
 (0)