【发布时间】:2017-01-13 03:45:30
【问题描述】:
我试图测试这段代码:
redireccion() {
this.$state.go('modifyLine', {lineId: this.look()._id});
}
look() {
return Entries.findOne({name: this.entry.name});
}
上面的代码方法没问题(看),但是对于“redirectcion”,我尝试了类似的方法,但出现错误。
这是代码:
describe('redireccion()', () => {
beforeEach( inject(($state) => {
spyOn($state, 'go');
spyOn(controller, 'look');
spyOn(Entries, 'findOne');
}));
it('should be a ... bla bla', () => {
controller.redireccion();
expect($state.go).toHaveBeenCalledWith('modifyLine', {lineId: });
});
});
这是摘录,因为我真的不知道如何测试。
【问题讨论】:
标签: javascript angularjs meteor jasmine angular-mock