我通常的测试用例看起来像
it("should send get request", inject(function(someServices) {
//some test
}));
而且Jasmine 2.0异步测试应该看起来像
it("should send get request", function(done) {
someAsync.then(function(){
done();
});
});
如何在一次测试中同时使用完成和注入?
这应该工作;我更新到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
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句