This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
angular-mocks matchData fails with dates #6126
Closed
Description
#5127 seems not solved in 1.2.11
Updated the plunkr of the previous submitter for the new version of Angular
I've traced the problem down to (angular-mocks)
this.matchData = function(d) {
if (angular.isUndefined(data)) return true;
if (data && angular.isFunction(data.test)) return data.test(d);
if (data && angular.isFunction(data)) return data(d);
if (data && !angular.isString(data)) return angular.equals(data, angular.fromJson(d)); // <--- this
return data == d;
};
Basically the object saved inside the expectations property of $httpBackend retain the normal date type
{ DateProperty : Wed Feb 05 2014 11:57:59 GMT+0000 (GMT Standard Time) }
while, as expected, JSON.parse()
contained in the angular.fromJson()
function produces:
{ DateProperty : "2014-02-05T11:57:59.000Z" }
considering this results angular.equals()
fails and matchData()
also fails accordingly