Read: Class 36 - 401-advanced-javascript-dania/amman-javascript-401d1 GitHub Wiki
Application State
Redux
Redux is a predictable state container for JavaScript apps.
It helps you write applications that behave consistently, run in different environments (client, server, and native), and are easy to test. On top of that, it provides a great developer experience, such as live code editing combined with a time traveling debugger.
You can use Redux together with React, or with any other view library. It is tiny (2kB, including dependencies), but has a large ecosystem of addons available.
#Installation Redux is available as a package on NPM for use with a module bundler or in a Node application:
NPM
npm install redux
Yarn
yarn add redux
# Jest Jest was never considered and I was thinking of using either Mocha or Jasmine, as these were the two frameworks I was comfortable with as I have used them on projects related to AngularJS earlier. But on further reading and research I decided to choose AVA due to it being simple to setup and ability to run in parallel. And I started using AVA till I stumbled upon this post, and that’s how I finally thought maybe I should try Jest These were the points I loved about Jest: I wanted some framework which could be easily setup and start testing. i.e spend minimum time to setup the framework for my project. Ability to run tests in parallel. This is where Mocha loses the battle for me. Well for this example running the tests in parallel is trivial. But for a huge app with lot of tests, it will be quick if the tests could run in parallel. Snapshot testing. This is a really cool feature I like. This helps me in reducing the number of tests I have to write as I just create a snapshot and if anything changes in my component, I will get an error when the snapshot is generated the next time. Jest uses Jasmine for assertion and since I have used Jasmine earlier, it was easy to write tests for me. Code coverage is available right out of the box. In-built Manual mocking (Haven’t tried yet) When Jest was introduced, it was considerably slow and it was kind of over engineered. But come 2016, and Facebook did a really good job in revamping Jest and I think in the coming months Jest will gain a lot of popularity. Below is from the Jest blog We feel incredibly humbled that 100+ companies have adopted Jest in the last six months. Companies like Twitter, Pinterest, Paypal, nytimes, IBM (Watson), Spotify, eBay, SoundCloud, Intuit, FormidableLabs, Automattic, Trivago and Microsoft have either fully or partially switched to Jest for their JavaScript testing needs.