+ + Unit Tests =
Alin Pandichi
Alin Pandichi Open space Coding Dojo Bucharest Java User Group Global Day of Coderetreat
Alin Pandichi Open space Coding Dojo Bucharest Java User Group Global Day of Coderetreat Software developer @ Mozaic Labs Building eventriX
Enzyme is a JavaScript testing utility for React  that makes it easier to assert, manipulate, and  traverse your React Components' output.
Jest:  Capture snapshots of React trees or other  serializable values to simplify testing and to  analyze how state changes over time. describe('Welcome (Snapshot)', () => { it('Welcome renders hello world', () => { const json = renderer.create(<Welcome />).toJSON(); expect(json).toMatchSnapshot(); }); });
Mocha is a JavaScript test framework  running on Node.js and in the browser. var assert = require('assert'); describe('Array', function() { describe('#indexOf()', function() { it('should return -1 when the value is not present', function() { assert.equal(-1, [1,2,3].indexOf(4)); }); }); });
Chai ­ assertion library for node and  the browser that can be paired with any  javascript testing framework. expect(foo).to.be.a('string'); expect(foo).to.equal('bar'); expect(foo).to.have.lengthOf(3); expect(tea).to.have.property('flavors').with.lengthOf(3);
Sinon.js ­ spies, stubs and mocks for  JavaScript. Works with any unit testing  framework. it('makes a GET request for todo items', function () { sinon.stub(jQuery, 'ajax'); getTodos(42, callbackFunction); assert(jQuery.ajax.calledWithMatch({ url: '/todo/42/items' })); });
Other testing tools:  ● redux­mock­store ­ A mock store for testing  your redux async action creators and  middleware.  ● fetch­mock ­ mock http requests made using  fetch
Istanbul – code coverage tool that works well  with most JavaScript testing  frameworks: tap, mocha, AVA, etc.
Resources http://mochajs.org/ http://chaijs.com/ http://sinonjs.org/ http://airbnb.io/enzyme/ https://istanbul.js.org/ https://github.com/arnaudbenard/redux­mock­store http://www.wheresrhys.co.uk/fetch­mock/ https://facebook.github.io/jest/
Image resources http://diysolarpanelsv.com/images/arrow­with­heart­in­middle­clipart­16.png https://i1.wp.com/www.tugberkugurlu.com/Content/images/Uploadedbyauthors/w http://1.bp.blogspot.com/­pkJqNgkmRe4/Tz0k6JUwJMI/AAAAAAAAAhU/h8byzSXB http://paulocoelhoblog.com/wp­content/uploads/2012/06/IsayNO1.jpg
How to unit test your React/Redux app

How to unit test your React/Redux app

Editor's Notes

  • #2 Hello and welcome to my talk about Covariance and Contravariance. Now, you must be wondering “What do covariance and contravariance have to do with dogs?” The answer to that is… Nothing! Absolutely nothing. This is one of the images I got as a result for an image search for “variance”. So I thought: “Sure, why the hell not?!”
  • #3 Okay, let me introduce myself. My name is Alin and this is me facilitating the open space during one of the Bucharest Agile Meetup events.
  • #4 I also organize monthly Coding Dojos. I&amp;apos;m one of the co-organizers of the Bucharest Java User Group. I am part of an awesome global team that organizes the Global Day of Coderetreat.
  • #5 During working hours, I am a software developer at Mozaic Labs, building eventriX