Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/content/6/en/part6a.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Let us expand <i>package.json</i> with a script for running the tests:
}
```

And finally, <i>.eslintrc.cjs</i> needs to be altered as follows:
And finally, we'd like to make the functions from 'jest' available globally. If your directory contains <i>.eslintrc.cjs</i>. it needs to be altered as follows:

```js
module.exports = {
Expand All @@ -432,6 +432,23 @@ module.exports = {
}
```

If you're using a newer version of <i>Vite</i>, modify <i>eslint.config.js</i> as follows:

```js
export default [
// ...
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: [...globals.browser, ...globals.jest], // highlight-line
// ...
},
// ...
},
]
```

To make testing easier, we'll first move the reducer's code to its own module, to the file <i>src/reducers/noteReducer.js</i>. We'll also add the library [deep-freeze](https://www.npmjs.com/package/deep-freeze), which can be used to ensure that the reducer has been correctly defined as an immutable function.
Let's install the library as a development dependency:

Expand Down