Angular 4 tests with MockBackend returns Promise

I copied and used the same code as in this question , including the answer. My versions of Angular's dependencies are package.jsoninstalled in 4.0.2, NodeJS has 7.5.0, and NPM has 4.1.2.

When I run the test, it responseappears in my case Promise.

expect(res).toBe(0);leads to a message Expected [object Promise] to be 0.on the console. expect(res.length).toBe(0);ends onExpected undefined to be 0.

When I use the second example from the official doc , the same thing happens.

The same problem can be fixed using Angular 4.0.0 dependencies.

Any ideas?

+4
source share
1 answer

, Response.

import { Response } from '@angular/http';
+9

Source: https://habr.com/ru/post/1675091/


All Articles