I have the following function written in an Ember route
delete(line) {
line.destroyRecord().then(() => {
this.store.unloadRecord(line);
this.controller.get('deliveryLines').removeObject(line);
});
},
My question is, should I write unit tests to cover it ?
After all, the function does not return anything, and does not have any side effects. Should I write unit tests to cover that the function is calling e.g. destroyRecord
or unloadRecord
?
You should write a unit test to cover it, because although it isn't doing anything of importance now, later it could save you from having to debug something that could be caused by this not being called.
Additionally it never hurts to know that your function is behaving the way it should.