diff --git a/docs/MockFunctions.md b/docs/MockFunctions.md index 0801739e8406..b5aeb3b78732 100644 --- a/docs/MockFunctions.md +++ b/docs/MockFunctions.md @@ -12,11 +12,12 @@ There are two ways to mock functions: Either by creating a mock function to use Let's imagine we're testing an implementation of a function `forEach`, which invokes a callback for each item in a supplied array. ```js title="forEach.js" -export function forEach(items, callback) { +function forEach(items, callback) { for (const item of items) { callback(item); } } +module.exports = forEach; ``` To test this function, we can use a mock function, and inspect the mock's state to ensure the callback is invoked as expected.