I copied and use the same code as you can see in this question including the answer. My Angular dependency versions in package.json
are set to 4.0.2, NodeJS has 7.5.0 and NPM has 4.1.2.
When I start the test response
seems to be a Promise
in my case.
expect(res).toBe(0);
leads to the message Expected [object Promise] to be 0.
on console. expect(res.length).toBe(0);
ends with Expected undefined to be 0.
When I use the second example from official doc the same thing happens.
The same issue can recreated with Angular 4.0.0 dependencies.
Any ideas?
Make sure you are importing the correct Response object.
import { Response } from '@angular/http';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With