mercredi 27 septembre 2017

Angular 4 Jasmine Actual is not a Function

I'm doing expect(ClassUnderTest.someMethod(withSomeParams)).toThrow() and I'm getting:-

Error: <toThrow> : Actual is not a Function
Usage: expect(function() {<expectation>}).toThrow(<ErrorConstructor>, <message>)

and I don't understand the usage example.

I tried expect(() => ClassUnderTest.someMethod(withSomeParams)).toThrow() I got Expected function to throw an exception.. And tried:-

ClassUnderTest.someMethod(withSomeParams)
              .subscribe( res => res,
                          err => console.log(err))

and I got Error: 1 periodic timer(s) still in the queue.

I don't understand how to write this expectation for when the error is thrown.

Aucun commentaire:

Enregistrer un commentaire