aboutsummaryrefslogtreecommitdiff
path: root/test/modules
diff options
context:
space:
mode:
authorMatt Mayer <[email protected]>2025-04-18 01:18:49 +0700
committerGitHub <[email protected]>2025-04-17 20:18:49 +0200
commit04e434682d9c58dcbaeda07232fd1e9c103d92d0 (patch)
treed47d5cd123cee85670926f61c86329ef7a3257e1 /test/modules
parent242cc79607b3c5a66e84d3d8c451d4ec353651ac (diff)
downloadfaker-04e434682d9c58dcbaeda07232fd1e9c103d92d0.tar.xz
faker-04e434682d9c58dcbaeda07232fd1e9c103d92d0.zip
test: use [email protected] with isULID, isISO31661Numeric, isISO15924 (#3482)
Diffstat (limited to 'test/modules')
-rw-r--r--test/modules/location.spec.ts6
-rw-r--r--test/modules/string.spec.ts2
2 files changed, 8 insertions, 0 deletions
diff --git a/test/modules/location.spec.ts b/test/modules/location.spec.ts
index 8af00f37..45d789a4 100644
--- a/test/modules/location.spec.ts
+++ b/test/modules/location.spec.ts
@@ -1,3 +1,6 @@
+import isISO31661Alpha2 from 'validator/lib/isISO31661Alpha2';
+import isISO31661Alpha3 from 'validator/lib/isISO31661Alpha3';
+import isISO31661Numeric from 'validator/lib/isISO31661Numeric';
import { describe, expect, it } from 'vitest';
import {
FakerError,
@@ -165,6 +168,7 @@ describe('location', () => {
expect(countryCode).toBeTruthy();
expect(countryCode).toMatch(/^[A-Z]{2}$/);
+ expect(countryCode).toSatisfy(isISO31661Alpha2);
});
it('returns random alpha-3 countryCode', () => {
@@ -172,6 +176,7 @@ describe('location', () => {
expect(countryCode).toBeTruthy();
expect(countryCode).toMatch(/^[A-Z]{3}$/);
+ expect(countryCode).toSatisfy(isISO31661Alpha3);
});
it('returns random numeric countryCode', () => {
@@ -179,6 +184,7 @@ describe('location', () => {
expect(countryCode).toBeTruthy();
expect(countryCode).toMatch(/^\d{3}$/);
+ expect(countryCode).toSatisfy(isISO31661Numeric);
});
});
diff --git a/test/modules/string.spec.ts b/test/modules/string.spec.ts
index 7b3be347..3dc8a255 100644
--- a/test/modules/string.spec.ts
+++ b/test/modules/string.spec.ts
@@ -1,3 +1,4 @@
+import isULID from 'validator/lib/isULID';
import { describe, expect, it } from 'vitest';
import { FakerError, faker } from '../../src';
import { seededTests } from '../support/seeded-runs';
@@ -774,6 +775,7 @@ describe('string', () => {
const ulid = faker.string.ulid();
const regex = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
expect(ulid).toMatch(regex);
+ expect(ulid).toSatisfy(isULID);
});
});