Skip to content

Commit

Permalink
docs: cleanup mock.calls structure (#10942)
Browse files Browse the repository at this point in the history
  • Loading branch information
lumosmind authored Dec 17, 2020
1 parent 04a914a commit b0f751e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ const result = [11, 12].filter(num => filterTestFn(num));

console.log(result);
// > [11]
console.log(filterTestFn.mock.calls);
// > [ [11], [12] ]
console.log(filterTestFn.mock.calls[0][0]); // 11
console.log(filterTestFn.mock.calls[0][1]); // 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.
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-22.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ const result = [11, 12].filter(num => filterTestFn(num));

console.log(result);
// > [11]
console.log(filterTestFn.mock.calls);
// > [ [11], [12] ]
console.log(filterTestFn.mock.calls[0][0]); // 11
console.log(filterTestFn.mock.calls[0][1]); // 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.
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-23.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ const result = [11, 12].filter(num => filterTestFn(num));

console.log(result);
// > [11]
console.log(filterTestFn.mock.calls);
// > [ [11], [12] ]
console.log(filterTestFn.mock.calls[0][0]); // 11
console.log(filterTestFn.mock.calls[0][1]); // 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.
Expand Down

0 comments on commit b0f751e

Please sign in to comment.