aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-04-23 12:28:48 +0200
committerGitHub <[email protected]>2023-04-23 12:28:48 +0200
commitacb9cf5a81ec42e64a59f4708345f1af63147a34 (patch)
tree5ba636d10f561ebc9a86d51c002bdc94695b8515 /test
parentf795269c3aa2014c4964ea71c38b53a51e0f6d47 (diff)
downloadfaker-acb9cf5a81ec42e64a59f4708345f1af63147a34.tar.xz
faker-acb9cf5a81ec42e64a59f4708345f1af63147a34.zip
refactor(locale): use null as not applicable (#2078)
Diffstat (limited to 'test')
-rw-r--r--test/person.spec.ts8
-rw-r--r--test/utils/merge-locales.spec.ts32
2 files changed, 36 insertions, 4 deletions
diff --git a/test/person.spec.ts b/test/person.spec.ts
index beca6643..dbd2169d 100644
--- a/test/person.spec.ts
+++ b/test/person.spec.ts
@@ -125,7 +125,7 @@ describe('person', () => {
...fakerMK.definitions.person.female_prefix,
...fakerMK.definitions.person.female_first_name,
...fakerMK.definitions.person.female_last_name,
- ...fakerMK.definitions.person.suffix,
+ // ...fakerMK.definitions.person.suffix, // Not applicable
];
const fullName = fakerMK.person.fullName({ sex: 'female' });
@@ -141,7 +141,7 @@ describe('person', () => {
...fakerMK.definitions.person.male_prefix,
...fakerMK.definitions.person.male_first_name,
...fakerMK.definitions.person.male_last_name,
- ...fakerMK.definitions.person.suffix,
+ // ...fakerMK.definitions.person.suffix, // Not applicable
];
const fullName = fakerMK.person.fullName({ sex: 'male' });
@@ -157,7 +157,7 @@ describe('person', () => {
...fakerMK.definitions.person.female_prefix,
'firstName',
'lastName',
- ...fakerMK.definitions.person.suffix,
+ // ...fakerMK.definitions.person.suffix, // Not applicable
];
const fullName = fakerMK.person.fullName({
@@ -177,7 +177,7 @@ describe('person', () => {
...fakerMK.definitions.person.male_prefix,
'firstName',
'lastName',
- ...fakerMK.definitions.person.suffix,
+ //...fakerMK.definitions.person.suffix, // Not applicable
];
const fullName = fakerMK.person.fullName({
diff --git a/test/utils/merge-locales.spec.ts b/test/utils/merge-locales.spec.ts
index 50e519d5..3fb24ff3 100644
--- a/test/utils/merge-locales.spec.ts
+++ b/test/utils/merge-locales.spec.ts
@@ -29,6 +29,38 @@ describe('mergeLocales', () => {
});
});
+ it('should not overwrite not applicable data', () => {
+ const locale1: LocaleDefinition = {
+ metadata: { title: 'a' },
+ location: {
+ city: null,
+ country: null,
+ },
+ };
+ const locale2: LocaleDefinition = {
+ metadata: { title: 'b' },
+ location: {
+ city: ['b'],
+ },
+ };
+ const locale3: LocaleDefinition = {
+ metadata: { title: 'c' },
+ location: {
+ city: ['c'],
+ country: ['c'],
+ },
+ };
+ const merged = mergeLocales([locale1, locale2, locale3]);
+
+ expect(merged).toEqual({
+ metadata: { title: 'a' },
+ location: {
+ city: null,
+ country: null,
+ },
+ });
+ });
+
it('should extend categories', () => {
const locale1: LocaleDefinition = {
metadata: { title: 'a' },