MockJS - Mockito syntax for JavaScript Unit Testing
A couple of weeks ago I’ve learnt about Mockito.
(yes, I’ve been hiding under a rock all this time)
Like most developers, I instantly found that Mockito’s API syntax makes it really easy to learn and use mock objects.
I’ve looked around for an equivalent in JavaScript but found nothing suitable…
Most solutions rely on unfriendly syntaxes or strange dependencies and, in my view, none was able to implement JavaScript mock objects in a simple and reliable way.
So, as a part-time project, I developed an alternative Mock object library in JavaScript.
I ported the raw concepts of Mockito, thrown in the JavaScript specifics, added a fresh perspective and some ECMA5 magic, mixed everything up in a repo and came up with something new.
The resulting project is MockJS and can be followed at https://github.com/badoo/MockJS
Read More »