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

254
Views
vue-test-utils, broma; ReferenceError: la solicitud no está definida

Estoy haciendo una llamada POST API usando el constructor ES6 Request() en mi aplicación vue.js. La implementación funciona bien, pero mi conjunto de pruebas (estoy usando Jest con vue-test-utils ) falla con el siguiente error:

ReferenceError: la solicitud no está definida

Aquí está el fragmento de código de mi caso de prueba:

 it('Expect login to pass validation on submit', ()=> { const $router = { push : jest.fn() } // const validateLogin = jest.fn(); const executeLoginSpy = jest.spyOn(wrapper.vm, 'executeLogin'); wrapper = mount(Login, { localVue, vuetify, mocks: { $router }, stubs: ['router-link'], data() { return { login: { email: 'test@testmail.com', password: 'test@@@@@@@@123' } } } }); const button = wrapper.find('.submit-btn'); button.trigger('click'); expect(executeLoginSpy).toHaveBeenCalled(); expect($router.push).toBeCalledWith('/'); });

También adjunto un fragmento de mi implementación usando Request() .

 const request = new Request('/api/token', { method: 'POST', body: formData, });

Cualquier ayuda sería apreciada. ¡Gracias por adelantado!

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