Skip to content

Commit 5a45171

Browse files
iamrahulroySimenB
authored andcommitted
Fix example code on using matchers docs (#8953)
* Fix example code on `using matchers` docs * Change UsingMatchers docs for version-22.x as well
1 parent aa10c19 commit 5a45171

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/UsingMatchers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ If you want to test that a particular function throws an error when it's called,
142142

143143
```js
144144
function compileAndroidCode() {
145-
throw new ConfigError('you are using the wrong JDK');
145+
throw new Error('you are using the wrong JDK');
146146
}
147147

148148
test('compiling android goes as expected', () => {
149149
expect(compileAndroidCode).toThrow();
150-
expect(compileAndroidCode).toThrow(ConfigError);
150+
expect(compileAndroidCode).toThrow(Error);
151151

152152
// You can also use the exact error message or a regexp
153153
expect(compileAndroidCode).toThrow('you are using the wrong JDK');

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ If you want to test that a particular function throws an error when it's called,
143143

144144
```js
145145
function compileAndroidCode() {
146-
throw new ConfigError('you are using the wrong JDK');
146+
throw new Error('you are using the wrong JDK');
147147
}
148148

149149
test('compiling android goes as expected', () => {
150150
expect(compileAndroidCode).toThrow();
151-
expect(compileAndroidCode).toThrow(ConfigError);
151+
expect(compileAndroidCode).toThrow(Error);
152152

153153
// You can also use the exact error message or a regexp
154154
expect(compileAndroidCode).toThrow('you are using the wrong JDK');

0 commit comments

Comments
 (0)