diff --git a/test/validators/isLength.test.js b/test/validators/isLength.test.js index 5c1444002..92f150e85 100644 --- a/test/validators/isLength.test.js +++ b/test/validators/isLength.test.js @@ -141,4 +141,31 @@ describe('isLength', () => { valid: ['👩đŸĻ°đŸ‘ŠđŸ‘ŠđŸ‘ĻđŸ‘ĻđŸŗī¸đŸŒˆ', 'âŠī¸ŽâŠī¸ŽâĒī¸ŽâĒī¸Žâ­ī¸Žâ­ī¸ŽâŽī¸ŽâŽī¸Ž'], }); }); + + it('should return true if string exactly match min/max bounds', () => { + test({ + validator: 'isLength', + args: [{ min: 3, max: 3 }], + valid: ['abc', 'def'], + invalid: ['abcd', 'efgh'], + }); + }); + + it('should count emojis as single character', () => { + test({ + validator: 'isLength', + args: [{ min: 1, max: 1 }], + valid: ['🚀', '🍕', 'A'], + invalid: ['🚀🚀', ''], + }); + }); + + it('should only allow strings with specific lengths from a list', () => { + test({ + validator: 'isLength', + args: [{ discreteLengths: [2, 5] }], + valid: ['to', 'hello'], + invalid: ['a', 'cat', 'lengthy'], + }); + }); });