import { IAnySchemaRules } from '~/domain/entities/schemas/any-schema'; import { getMakeSut } from './helpers'; describe('Integration - Array Tests - Required', () => { const makeSut = getMakeSut('object'); const req = (value: boolean): IAnySchemaRules => ({ required: value }); describe('[required = true], should throw error if value is falsy', () => { test.each([null, undefined])('should allow %s', value => { const { sut } = makeSut(req(true)); expect(sut.validate(value)).not.toBeValidResult(); }); }); describe('[required = false], should not throw error if value is falsy', () => { test.each([null, undefined])('should allow %s', value => { const { sut } = makeSut(req(false)); expect(sut.validate(value)).toBeValidResult(); }); }); });