Skip to content

Commit

Permalink
Harden tests against with missing "locale" option
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbucket-dev committed Oct 25, 2022
1 parent 8b1fda9 commit f8e36b7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/validators/isAlphanumeric.test.js
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -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', () => {
Expand Down

0 comments on commit f8e36b7

Please sign in to comment.