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

134
Vistas
Angular 2 Testing Service with nested Service

base.service.ts

export class BaseService {
    constructor(private http:Http){}
        search(segment: string, param: string){
             //build url
             this.http.get(....){}
        }
    }

my.service.ts

export class MyService {
    constructor(private baseService:Baservice){}
        search(segment: string, param: string){
             //build url
             this.baseService.search('people','1'){}
        }
    }

Base Service is a generic service that will build url and get data from server and return observable.

Now I want to put MyService under test. How can I mock Base Service because the different data sets will be returned with different 'segment' and 'param'

Thanks

over 4 years ago · Santiago Trujillo
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