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

后端 未结 5 1371
伪装坚强ぢ
伪装坚强ぢ 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:36

    To add to the answer of @Scott Boring and to the comment of @WhiteAngel who mentionned that the code inside inject was never called.

    This worked for me:

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

提交回复
热议问题