O'Reilly logo

Cross-platform Desktop Application Development: Electron, Node, NW.js, and React by Dmitry Sheiko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit-testing Redux

We have already fiddled with the Jest testing framework in Chapter 4, Chat System with Electron and React: Enhancement, Testing, and Delivery (Writing Unit-tests section). Redux introduces new concepts, such as actions and reducers. Now, we are going to unit-test them.

As you may remember, to run Jest, we need to configure Babel:

.babelrc

{   "presets": [      ["env", {       "targets": { "node": 7 },       "useBuiltIns": true     }],     "react",     "stage-3"   ],     "plugins": [     "transform-class-properties",     "transform-decorators-legacy"   ] } 

Again, with env preset, we target Babel on Node.js 7 and enable the extra plugins we used in the webpack configuration.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required