I\'m having hard times trying to test promise-based code in Angularjs.
I have the following code in my controller:
$scope.markAsDone = function(t
Another approach would be the following, taken straight out of a controller I was testing:
var create_mock_promise_resolves = function (data) {
return { then: function (resolve) { return resolve(data); };
};
var create_mock_promise_rejects = function (data) {
return { then: function (resolve, reject) { if (typeof reject === 'function') { return resolve(data); } };
};
var create_noop_promise = function (data) {
return { then: function () { return this; } };
};