diff options
| author | ST-DDT <[email protected]> | 2023-04-23 12:28:48 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-23 12:28:48 +0200 |
| commit | acb9cf5a81ec42e64a59f4708345f1af63147a34 (patch) | |
| tree | 5ba636d10f561ebc9a86d51c002bdc94695b8515 /test/utils | |
| parent | f795269c3aa2014c4964ea71c38b53a51e0f6d47 (diff) | |
| download | faker-acb9cf5a81ec42e64a59f4708345f1af63147a34.tar.xz faker-acb9cf5a81ec42e64a59f4708345f1af63147a34.zip | |
refactor(locale): use null as not applicable (#2078)
Diffstat (limited to 'test/utils')
| -rw-r--r-- | test/utils/merge-locales.spec.ts | 32 |
1 files changed, 32 insertions, 0 deletions
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' }, |
