devleague/js-calculator

Most tests for `add` validator check pass by default

thgaskell opened this issue · 1 comments

The validator test for the add method passes most cases by default since it's checking for the return value to be a string value.

Examples

1 + ''  // => "1"
1 + []  // => "1"
1 + {}  // => "1[object Object]"
1 + (function () {})  // => "1function () {}"

We might want to fix this by enforcing a specific error string to be returned, or maybe to throw errors?

I'm for throwing errors. I think in general throwing critical errors and handling is a good process that we don't explicitly cover as a design concept.