【发布时间】:2017-09-28 01:46:29
【问题描述】:
我正在做expect(ClassUnderTest.someMethod(withSomeParams)).toThrow(),我得到:-
Error: <toThrow> : Actual is not a Function
Usage: expect(function() {<expectation>}).toThrow(<ErrorConstructor>, <message>)
我不明白使用示例。
我尝试了expect(() => ClassUnderTest.someMethod(withSomeParams)).toThrow() 我得到了Expected function to throw an exception.。并尝试过:-
ClassUnderTest.someMethod(withSomeParams)
.subscribe( res => res,
err => console.log(err))
我得到了Error: 1 periodic timer(s) still in the queue.
我不明白如何为抛出错误的时间编写这个期望。
【问题讨论】:
标签: angular testing jasmine karma-jasmine