Are there any situations where a function or method doesn't need to be covered by a unit test? What situations would they be or do they not exist?
For example I have the following function. It makes one call to another function, 'formatName' which is 100% covered by unit tests.
function SeatReservation(name, initialMeal) {
self.formattedName = ko.computed(function () {
return AH.Helpers.formatName(self.name);
});
}
Is the above function a bit redundant because all it does is call another method but then again I want to keep as much of the logic in my viewmodel.
If I do need a test for the above is it ok to just check formatName has been called using a spy
ok(AH.Helpers.formatName.calledOnce);
Should getters be covered?
Aucun commentaire:
Enregistrer un commentaire