import { range } from 'ramda'; import { themis } from '~/main'; import { doManyTests } from '~/tests/integration/helpers'; describe('Themis - Schema with String Tests', () => { const schema = themis.string({ required: true, min: 5, max: 10, }); const testMany = doManyTests(schema); /** * Array with only alpha strings that satisfies: [5 <= string.length <= 10]; */ const stringsWithValidLength = range(5, 10 + 1).map(size => range(0, size).join('')); testMany.valid([...stringsWithValidLength]); testMany.invalid([undefined, 'bata', 'p', '', 'size=11'.padEnd(11, '-'), 'z'.repeat(20)]); });