diff --git a/CHANGELOG.md b/CHANGELOG.md index 968f63cea419..fc2f6c048665 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,8 @@ alias. * `[docs]` Include missing dependency in TestEnvironment sample code * `[docs]` Add clarification for hook execution order +* `[docs]` Update `expect.anything()` sample code + ([#5007](https://github.com/facebook/jest/pull/5007)) ## jest 21.2.1 diff --git a/docs/ExpectAPI.md b/docs/ExpectAPI.md index 07bb4be5017b..9c108aa37e39 100644 --- a/docs/ExpectAPI.md +++ b/docs/ExpectAPI.md @@ -159,7 +159,7 @@ you want to check that a mock function is called with a non-null argument: ```js test('map calls its argument with a non-null argument', () => { const mock = jest.fn(); - [1].map(mock); + [1].map(x => mock(x)); expect(mock).toBeCalledWith(expect.anything()); }); ```