茉莉花2.0异步()和角嘲笑同一测试注入()() [英] Jasmine 2.0 async done() and angular-mocks inject() in same test it()

查看:181
本文介绍了茉莉花2.0异步()和角嘲笑同一测试注入()()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常的测试用例看起来像

My usual test case looks like

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

和茉莉花2.0异步测试应该像

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?

推荐答案

这应该工作;我遇到了同样的问题,当我更新到2.0茉莉花

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();
    })
});

这篇关于茉莉花2.0异步()和角嘲笑同一测试注入()()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆