You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
9 Hrs
7 Min
3 Seg

Pruebas a validadores

14/17
Resources

Contributions 2

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

Código de la prueba: ```ts import { FormControl, FormGroup } from "@angular/forms"; import { MyValidators } from "./validators"; fdescribe('test fot MyValidators', () => { describe('test fot validPassword', () => { it('should return null when password is right', () => { const control = new FormControl(); control.setValue('ana123'); const rta = MyValidators.validPassword(control); expect(rta).toBeNull() }) it('should return null when password is wrong', () => { const control = new FormControl(); control.setValue('asasasas'); const rta = MyValidators.validPassword(control); expect(rta?.invalid_password).toBeTrue() }) }); describe('test for matchPasswords', () => { it('should return null', () => { const group = new FormGroup({ password: new FormControl('123456'), confirmPassword: new FormControl('123456') }); const rta = MyValidators.matchPasswords(group); expect(rta).toBeNull(); }); it('should return obj with the error', () => { const group = new FormGroup({ password: new FormControl('123456'), confirmPassword: new FormControl('123a456') }); const rta = MyValidators.matchPasswords(group); expect(rta?.match_password).toBeTrue(); }); it('should error with send other data', () => { const group = new FormGroup({ opt: new FormControl('123456'), opt2: new FormControl('123a456') }); const fn = () => { MyValidators.matchPasswords(group) } expect(fn).toThrow(new Error('matchPasswords: fields not found')); }); }); }) ```

honestamente al final de esta clase sentí que el profe ya se “ostinó” de dar clases de angular XD pero lo quiero igual!