【发布时间】:2018-10-25 20:57:18
【问题描述】:
我试图通过在 Angular 2 中使用 Jasmine 来编写一个警报测试用例。但是无论我的测试用例如何给出错误,即使我不确定我是否写了正确的方法。如果有任何想法,请帮助我。
这是我的测试用例:
it('checking showscheduledrequest flow an alert is called',() =>{
let component = fixture.componentInstance;
component['ou'] = 'd';
component['sen'] = 'ddsd';
var oldalert = alert;
oldalert = jasmine.createSpy();
component.handleActionChane('showscheduledrequest');
fixture.autoDetectChanges();
expect(alert).toHaveBeenCalledWith('This is not a valid request');
});
【问题讨论】:
标签: angular unit-testing karma-jasmine