This site has been updated.
Reload to display the latest version?
(click here)

Tag:  mocks

How to mock components with jest

03 May, 2019
I have already written a post about mocking moment.js for tests. Today let’s talk about how to use mocks in a specific tests framework - Jest. Jest was developed by Facebook and was based on another tests library called Jasmine. It meant that Jest used widely popular test syntax and could be adapted very easily.

How to test code that uses moment.js

05 November, 2018
I’m going to talk about unit tests here, not any other kind of tests. And unit tests have, in my opinion, the following list of criteria that they have to meet. This list makes it hard to write tests for code that use external libraries, especially ones that manipulate time: Unit tests should be able to run on the developer’s machine as well as on the remote server Unit tests shouldn’t relate to timezone Each tested class (or component) should be tested independently from external libraries…