我正在使用 expect(ClassUnderTest.someMethod(withSomeParams)).toThrow()
,但我遇到了以下问题:
Error: <toThrow> : Actual is not a Function
Usage: expect(function() {<expectation>}).toThrow(<ErrorConstructor>, <message>)
我不理解使用示例。
我尝试了 expect(() => ClassUnderTest.someMethod(withSomeParams)).toThrow()
,结果得到了 期望函数抛出异常。
。我还尝试了:
ClassUnderTest.someMethod(withSomeParams)
.subscribe( res => res,
err => console.log(err))
我收到了一个错误信息:Error: 1 periodic timer(s) still in the queue.
我不知道如何编写正确的代码以应对这种错误。