From 7bd3bb7b6bf5d1958e6f8688858ea685459d20e8 Mon Sep 17 00:00:00 2001 From: Sebastian Aberastury Date: Thu, 10 Jun 2021 07:39:48 -0300 Subject: [PATCH 1/2] Update MockFunctions.md --- website/versioned_docs/version-27.0/MockFunctions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 9a866d0028050bb90bde72511630964799cdb527 Mon Sep 17 00:00:00 2001 From: Sebastian Aberastury Date: Sat, 19 Jun 2021 01:07:33 -0300 Subject: [PATCH 2/2] Update MockFunctions.md --- docs/MockFunctions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.