huston007 huston007 - 7 months ago 188
Javascript Question

Jasmine 2.0 async done() and angular-mocks inject() in same test it()

My usual test case looks like

it("should send get request", inject(function(someServices) {
//some test
}));


And Jasmine 2.0 async test should look like

it("should send get request", function(done) {
someAsync.then(function(){
done();
});
});


How can I use both done and inject in one test?

Answer

This should work; I ran into the same problem when I updated to Jasmine 2.0

it("should send get request", function(done) {
    inject(function(someServices) {
        //some async test
        done();
    })
});