December 2015
Intermediate to advanced
240 pages
4h 57m
English
Sometimes, you may want to compare two values or objects in your way. By defining a custom equality tester, you can modify how Jasmine determines if two values are equal or not.
Whenever an expectation needs to check for equality, custom equality tester will first be used. It would return true or false if it knows how to compare; otherwise, undefined will be returned. If undefined is returned, then only Jasmine's default equality testers will be used.
Let's modify employee.js once more to add setter getter for the e-mail so that we can use in our custom equality tester:
Employee.prototype.setEmail = function(email){
this.email = email;
}
Employee.prototype.getEmail = function(){
return this.email;
}To create a custom ...
Read now
Unlock full access