diff --git a/docs/MockFunctions.md b/docs/MockFunctions.md index 3e2ccf7a3d15..ad566722e828 100644 --- a/docs/MockFunctions.md +++ b/docs/MockFunctions.md @@ -106,7 +106,7 @@ const result = [11, 12].filter(num => filterTestFn(num)); console.log(result); // > [11] console.log(filterTestFn.mock.calls[0][0]); // 11 -console.log(filterTestFn.mock.calls[0][1]); // 12 +console.log(filterTestFn.mock.calls[1][0]); // 12 ``` Most real-world examples actually involve getting ahold of a mock function on a dependent component and configuring that, but the technique is the same. In these cases, try to avoid the temptation to implement logic inside of any function that's not directly being tested. diff --git a/website/versioned_docs/version-27.0/MockFunctions.md b/website/versioned_docs/version-27.0/MockFunctions.md index 3e2ccf7a3d15..ad566722e828 100644 --- a/website/versioned_docs/version-27.0/MockFunctions.md +++ b/website/versioned_docs/version-27.0/MockFunctions.md @@ -106,7 +106,7 @@ const result = [11, 12].filter(num => filterTestFn(num)); console.log(result); // > [11] console.log(filterTestFn.mock.calls[0][0]); // 11 -console.log(filterTestFn.mock.calls[0][1]); // 12 +console.log(filterTestFn.mock.calls[1][0]); // 12 ``` Most real-world examples actually involve getting ahold of a mock function on a dependent component and configuring that, but the technique is the same. In these cases, try to avoid the temptation to implement logic inside of any function that's not directly being tested.