I have a ternary that seems to be returning a passing test, but it is failing.
$scope.depart = (typeof serverShortDate !== 'undefined') ? new Date(serverShortDate) : new Date();
AssertionError: expected Wed, 30 Mar 2016 21:26:12 GMT to deeply equal Wed, 30 Mar 2016 21:26:12 GMT
Here is my simple spec
All that I can imagine is that somewhere is a difference. The error message shows the same values.
The problem you have that
=== on objects checks that the two objects are the same object.
=== works slightly differently for objects when compared to strings or numbers.
Your test appears compares a new Date object to
scope.depart, by definition these objects are not the same object and can never be 'deeply' equal.
You could change your test to:
to check that both dates represent the same date/time.
You need to stringify the responses to test.