Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$httpBackend.expectGET is not a function #159

Open
randalmaia opened this issue Oct 26, 2015 · 1 comment
Open

$httpBackend.expectGET is not a function #159

randalmaia opened this issue Oct 26, 2015 · 1 comment

Comments

@randalmaia
Copy link

_app.js_

var initApp = function initApp(angularAMD) {
    var modules = [ 'ngRoute', 'ngResource', 'ngMock', 'tourModule'];
    var App = angular.module( 'App', modules );
    return angularAMD.bootstrap( App );
};

_tourModuleTest.js_

define( [ 'app', 'angularAMD','tourModule' ], function(app, angularAMD) {

    describe( 'tourModule', function() {
        var service,tourService,$httpBackend, $rootScope;

        beforeEach( function() {
            angularAMD.inject( function($injector) {
                service = $injector.get('tourInvoiceService');
                $rootScope =  $injector.get('$rootScope');
                $httpBackend = $injector.get('$httpBackend');
                $httpBackend.expectGET('.../url/',{})
                $httpBackend.whenGET('.../url/',{});

            } );
        } );
        ...
        it( 'Verify tourService.start has been called', function() {
            service();
            $httpBackend.flush();
        } );
    } );
} );

My app.js is exclusive for karma run.
TourModule is app dependency.

This is the _$httpBackend object_ on debug.
screenshot from 2015-10-26 10 30 24

@randalmaia
Copy link
Author

If I inject $httpBackend without AngularAMD.inject and with default inject the methods(get, whenGet) exist, but the $httpBackend.flush dont find none http request to mock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant