import { themis } from '~/main'; describe('Integration - Array Tests', () => { const makeArray = (length: number, value: V) => new Array(length).fill('').map(() => value); const N = 5; test.each([0, 1, 2, 3, 5])(`if max is set to ${N}, should allow arrays with length = %d`, (length: number) => { const sut = themis.array({ required: true, max: N, items: themis.number({}) }); expect(sut.validate(makeArray(length, 1))).toBeValidResult(); }); test.each([6, 7, 8, 9, 10])(`if max is set to ${N}, should not allow arrays with length = %d`, (length: number) => { const sut = themis.array({ required: true, max: N, items: themis.number({}) }); expect(sut.validate(makeArray(length, 1))).not.toBeValidResult(); }); });