RestrictAgeValidator } from './restrict-age.validator'; describe('RestrictAgeValidator', () => { describe('restricts age correctly', () => { it('should not return null when given age is under the required age', () => { const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); const formGroup = new FormGroup({ age: new FormControl(9), room: new FormControl({ text: 'room 2', value: 'room-2' }), }); const result = validatorFn(formGroup); expect(result).not.toEqual(null); }); it('should return null when given age is above the required age', () => { const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 it('should not return null when given age is under the required age', () => { const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); const formGroup = new FormGroup({ age: new FormControl(9), room: new FormControl({ text: 'room 2', value: 'room-2' }), }); const result = validatorFn(formGroup); expect(result).not.toEqual(null); }); import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 it('should return null when given age is above the required age', () => { 19 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 20 const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 it('should not return null when given age is under the required age', () => { 6 7 8 const formGroup = new FormGroup({ 9 age: new FormControl(9), 10 room: new FormControl({ text: 'room 2', value: 'room-2' }), 11 }); 12 13 const result = validatorFn(formGroup); 14 15 expect(result).not.toEqual(null); 16 }); 17 18 it('should return null when given age is above the required age', () => { 19 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 20 const formGroup = new FormGroup({ age: new FormControl(9), room: new FormControl({ text: 'room 2', value: 'room-2' }), }); import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 it('should not return null when given age is under the required age', () => { 6 const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); 7 8 9 10 11 12 13 const result = validatorFn(formGroup); 14 15 expect(result).not.toEqual(null); 16 }); 17 18 it('should return null when given age is above the required age', () => { 19 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 20 const result = validatorFn(formGroup); import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 it('should not return null when given age is under the required age', () => { 6 const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); 7 8 const formGroup = new FormGroup({ 9 age: new FormControl(9), 10 room: new FormControl({ text: 'room 2', value: 'room-2' }), 11 }); 12 13 14 15 expect(result).not.toEqual(null); 16 }); 17 18 it('should return null when given age is above the required age', () => { 19 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 20 expect(result).not.toEqual(null); import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 it('should not return null when given age is under the required age', () => { 6 const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); 7 8 const formGroup = new FormGroup({ 9 age: new FormControl(9), 10 room: new FormControl({ text: 'room 2', value: 'room-2' }), 11 }); 12 13 const result = validatorFn(formGroup); 14 15 16 }); 17 18 it('should return null when given age is above the required age', () => { 19 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 20 it('should return null when given age is above the required age', () => { const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 it('should not return null when given age is under the required age', () => { 6 const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); 7 8 const formGroup = new FormGroup({ 9 age: new FormControl(9), 10 room: new FormControl({ text: 'room 2', value: 'room-2' }), 11 }); 12 13 const result = validatorFn(formGroup); 14 15 expect(result).not.toEqual(null); 16 }); 17 18 19 20 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 it('should not return null when given age is under the required age', () => { 6 const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); 7 8 const formGroup = new FormGroup({ 9 age: new FormControl(9), 10 room: new FormControl({ text: 'room 2', value: 'room-2' }), 11 }); 12 13 const result = validatorFn(formGroup); 14 15 expect(result).not.toEqual(null); 16 }); 17 18 it('should return null when given age is above the required age', () => { 19 20 import { FormControl, FormGroup } from '@angular/forms'; 1 import { RestrictAgeValidator } from './restrict-age.validator'; 2 3 describe('RestrictAgeValidator', () => { 4 describe('restricts age correctly', () => { 5 it('should not return null when given age is under the required age', () => { 6 const validatorFn = RestrictAgeValidator.restrictAgeValidator(10); 7 8 const formGroup = new FormGroup({ 9 age: new FormControl(9), 10 room: new FormControl({ text: 'room 2', value: 'room-2' }), 11 }); 12 13 const result = validatorFn(formGroup); 14 15 expect(result).not.toEqual(null); 16 }); 17 18 it('should return null when given age is above the required age', () => { 19 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 20 const result = validatorFn(formGroup); expect(result).toEqual(null); ({ , }), }); 12 13 const result = validatorFn(formGroup); 14 15 expect(result).not.toEqual(null); 16 }); 17 18 it('should return null when given age is above the required age', () => { 19 const validatorFn = RestrictAgeValidator.restrictAgeValidator(18); 20 21 const formGroup = new FormGroup({ 22 age: new FormControl(20), 23 room: new FormControl({ text: 'room 2', value: 'room-2' }), 24 }); 25 26 27 28 29 }); 30 }); 31 }); 32