Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
Angular 4 test with MockBackend returns Promise

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?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Make sure you are importing the correct Response object.

import { Response } from '@angular/http';
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!