angular icon indicating copy to clipboard operation
angular copied to clipboard

How to include angular-mocks

Open mwq27 opened this issue 9 years ago • 0 comments

If I try this:

var angular = require('angular'),
    inject = angular.injector(['ng']).invoke;
require('angular-mocks');

describe('Auth Service', function() {
    var $httpBackend;   
    describe('Login method', function() {
        inject(function(_$httpBackend_, $q) {
                $httpBackend = _$httpBackend_;
                console.log($httpBackend);
        });
    });
});

I get an error that says 'window is not defined', which is coming from requiring angular-mocks. Is there something else I can try so that I can use the $httpBackend service for testing $http?

Thanks

mwq27 avatar Mar 03 '15 20:03 mwq27