diff options
| author | Matt Mayer <[email protected]> | 2024-11-08 17:57:53 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-11-08 11:57:53 +0100 |
| commit | 525fedc91bd02f53330cfb40fe228b148dcf562b (patch) | |
| tree | ab36406c307c499ddbad4ddbd9c9ef78b81c92d1 /test | |
| parent | 69173a36ed2854712cc27ddceed9a92bacf48336 (diff) | |
| download | faker-525fedc91bd02f53330cfb40fe228b148dcf562b.tar.xz faker-525fedc91bd02f53330cfb40fe228b148dcf562b.zip | |
fix(internet): ensure domainWord always returns a valid value in all locales (#3253)
Diffstat (limited to 'test')
| -rw-r--r-- | test/modules/internet.spec.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/modules/internet.spec.ts b/test/modules/internet.spec.ts index 84ded3d4..cade8ddf 100644 --- a/test/modules/internet.spec.ts +++ b/test/modules/internet.spec.ts @@ -1,6 +1,6 @@ import validator from 'validator'; import { describe, expect, it } from 'vitest'; -import { allFakers, faker } from '../../src'; +import { allFakers, faker, fakerKO } from '../../src'; import { FakerError } from '../../src/errors/faker-error'; import { IPv4Network } from '../../src/modules/internet'; import { seededTests } from '../support/seeded-runs'; @@ -667,6 +667,17 @@ describe('internet', () => { validator.isFQDN(value, { require_tld: false }) ); }); + + it('should return a lower-case domain in non-ASCII locales', () => { + const domainWord = fakerKO.internet.domainWord(); + + expect(domainWord).toBeTruthy(); + expect(domainWord).toBeTypeOf('string'); + expect(domainWord).toSatisfy(validator.isSlug); + expect(domainWord).toSatisfy((value: string) => + validator.isFQDN(value, { require_tld: false }) + ); + }); }); describe('ip()', () => { |
