From f8e36b716a45860d09802c0ec932e1355473e4b8 Mon Sep 17 00:00:00 2001 From: Falk Schieber <12937991+pixelbucket-dev@users.noreply.github.com> Date: Tue, 25 Oct 2022 15:24:09 +0200 Subject: [PATCH] Harden tests against with missing "locale" option --- test/validators/isAlphanumeric.test.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/validators/isAlphanumeric.test.js b/test/validators/isAlphanumeric.test.js index 3815532be..b0f32eb0b 100644 --- a/test/validators/isAlphanumeric.test.js +++ b/test/validators/isAlphanumeric.test.js @@ -1,7 +1,7 @@ import { test } from '../testFunctions'; describe('isAlphanumeric', () => { - it('should validate alphanumeric strings', () => { + it('should validate alphanumeric strings with missing `locale` option', () => { test({ validator: 'isAlphanumeric', valid: [ @@ -16,6 +16,21 @@ describe('isAlphanumeric', () => { 'Jön', ], }); + + test({ + validator: 'isAlphanumeric', + args: [{ ignore: '@_- ' }], // ignore [@ space _ -] + valid: [ + 'Hello@123', + 'this is a valid alphaNumeric string', + 'En-US @ alpha_numeric', + ], + invalid: [ + 'In*Valid', + 'hello$123', + '{invalid}', + ], + }); }); it('should validate alphanumeric string with ignored characters', () => {