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

278
Views
Probar una validación personalizada usando Vee-Validate falla con el error "UnhandledPromiseRejection"

Estoy tratando de probar la funcionalidad de registro y recibo este error:

 [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: [vee-validate] No such validator 'verify_password' exists.".] { code: 'ERR_UNHANDLED_REJECTION' }

Esta es la prueba:

 it('routes to root when successfully signed up', async () => { let router = new VueRouter() const wrapper = mount(SignUpUser, { localVue, router, }) const usernameField = wrapper.findComponent('#username'); usernameField.setValue('Avi') const emailField = wrapper.findComponent("#email") emailField.setValue('avi@avi.com') const passwordField = wrapper.findComponent('#password') passwordField.setValue('Admin@123') const passwordConfirmationField = wrapper.findComponent('#password_confirmation') passwordConfirmationField.setValue('Admin@123') const submitBtn = wrapper.findComponent('button') submitBtn.trigger('click'); expect(router.currentRoute.path).toBe('/') })

Este es el elemento HTML particular donde estoy usando la validación de verify_password :

 <input id="password" ref="password" v-model="password" v-validate="'required|min:8|verify_password'" type="password" name="password" >

La validación de app.vue verify_password tal:

 Vue.use(VeeValidate); <script> import BackToTop from 'vue-backtotop' import eventService from './eventService' import VeeValidate from 'vee-validate' VeeValidate.Validator.extend('verify_password', { getMessage: (field) => `The password must contain at least: 1 uppercase letter, 1 lowercase letter, 1 number, and one special character (Eg , . _ & ? etc)`, validate: (value) => { let strongRegex = new RegExp('^(?=.*[az])(?=.*[AZ])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})') return strongRegex.test(value) }, })

La validación funciona perfectamente en el navegador pero la prueba falla.

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!