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

125
Vistas
Probar búsqueda con broma

Tengo un método en el componente Vue con fetch, cómo verificar con jest + vtu

expect(wrapper.vm.collectionRelatedEntries).toEqual('related_entries')

O algo más en then(() => { //haz algo más })

 requestRemoveEntry(url){ this.addPreloader = true return fetch(url, { method: 'DELETE', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(this.selectedIdEntries) }) .then(response => { if(response.ok){ if(response.status === 204){ this.selectedIdEntries = [] this.stateSelected = false } if(response.status === 200){ return response.json().then((data) => { this.collectionRelatedEntries = data.related_entries }) } }else { this.isShowModalError = true } }) .then(() => { //do something else }) .catch((error) => { this.isShowModalError = true }) .finally(() => this.addPreloader = false) }, test('test method for remove entry', async () => { global.fetch = jest.fn(() => Promise.resolve({data: [{ 'title': 'title', id: 'id', related_entries: ['related_entries'] }], ok: true, status: 200})); wrapper.setData({ statusMassDelete: false }) await wrapper.vm.requestRemoveEntry('/api/get_entries', 'id') expect(fetch).toHaveBeenCalledWith("/api/get_entries", {"body": null, "headers": {"Content-Type": "application/json"}, "method": "DELETE"})

expect(wrapper.vm.collectionRelatedEntries).toEqual('related_entries') })

about 4 years ago · Juan Pablo Isaza
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