Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
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 Respuestas
Responde la pregunta

0

Make sure you are importing the correct Response object.

import { Response } from '@angular/http';
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda