I am writing a test that involves Angular's fork of $q. Using Sinon, I am trying to stub it but not having a success...
beforeEach(function() {
module('info.deployments');
inject(function($rootScope, $controller, $q) {
$scope = $rootScope.$new();
$controller('deploy.new', {
$scope: $scope
});
$q = sinon.stub($q, 'all');
$q = $q.all.withArgs(["foo", "boo"]).returns($q.all.resolve("first", "second"));
});
});
describe('instantiation', function() {
it('call promise', function() {
return expect($q.all).to.have.been.called;
});
TypeError: 'undefined' is not an object (evaluating '$q.all.withArgs')
Aucun commentaire:
Enregistrer un commentaire