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

后端 未结 5 1363
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 18:11

My usual test case looks like

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

And Jasmine 2.0 async

5条回答
  •  借酒劲吻你
    2020-12-08 18:39

    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();
        })(); // function returned by 'inject' has to be invoked
    });
    

提交回复
热议问题