Skip to content

Commit

Permalink
Fix example code on using matchers docs (#8953)
Browse files Browse the repository at this point in the history
* Fix example code on `using matchers` docs

* Change UsingMatchers docs for version-22.x as well
  • Loading branch information
iamrahulroy authored and SimenB committed Sep 13, 2019
1 parent aa10c19 commit 5a45171
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/UsingMatchers.md
Expand Up @@ -142,12 +142,12 @@ If you want to test that a particular function throws an error when it's called,

```js
function compileAndroidCode() {
throw new ConfigError('you are using the wrong JDK');
throw new Error('you are using the wrong JDK');
}

test('compiling android goes as expected', () => {
expect(compileAndroidCode).toThrow();
expect(compileAndroidCode).toThrow(ConfigError);
expect(compileAndroidCode).toThrow(Error);

// You can also use the exact error message or a regexp
expect(compileAndroidCode).toThrow('you are using the wrong JDK');
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-22.x/UsingMatchers.md
Expand Up @@ -143,12 +143,12 @@ If you want to test that a particular function throws an error when it's called,

```js
function compileAndroidCode() {
throw new ConfigError('you are using the wrong JDK');
throw new Error('you are using the wrong JDK');
}

test('compiling android goes as expected', () => {
expect(compileAndroidCode).toThrow();
expect(compileAndroidCode).toThrow(ConfigError);
expect(compileAndroidCode).toThrow(Error);

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

0 comments on commit 5a45171

Please sign in to comment.