diff --git a/src/definitions/location.ts b/src/definitions/location.ts index 079bc22ed71..f8e277885be 100644 --- a/src/definitions/location.ts +++ b/src/definitions/location.ts @@ -12,6 +12,8 @@ export type LocationDefinition = LocaleEntry<{ [state: string]: string | string[]; }; + postcode_prefix: string[]; + /** * Postcodes patterns. */ diff --git a/src/locales/cy/location/index.ts b/src/locales/cy/location/index.ts index ca01acd6427..3d5c0b4a89e 100644 --- a/src/locales/cy/location/index.ts +++ b/src/locales/cy/location/index.ts @@ -6,11 +6,15 @@ import type { LocationDefinition } from '../../..'; import county from './county'; import direction from './direction'; import postal_address from './postal_address'; +import postcode from './postcode'; +import postcode_prefix from './postcode_prefix'; const location: LocationDefinition = { county, direction, postal_address, + postcode, + postcode_prefix, }; export default location; diff --git a/src/locales/cy/location/postcode.ts b/src/locales/cy/location/postcode.ts new file mode 100644 index 00000000000..f242f69e8be --- /dev/null +++ b/src/locales/cy/location/postcode.ts @@ -0,0 +1,4 @@ +export default [ + '{{location.postcode_prefix}}# #??', + '{{location.postcode_prefix}}## #??', +]; diff --git a/src/locales/cy/location/postcode_prefix.ts b/src/locales/cy/location/postcode_prefix.ts new file mode 100644 index 00000000000..9e84f0ca9e9 --- /dev/null +++ b/src/locales/cy/location/postcode_prefix.ts @@ -0,0 +1 @@ +export default ['CF', 'CH', 'HR', 'LD', 'LL', 'NP', 'SA', 'SY']; diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index 98bd7879c6c..b8562330b01 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -269,6 +269,9 @@ export class LocationModule extends SimpleLocationModule { } let { format = this.faker.definitions.location.postcode } = options; + + format = this.faker.helpers.fake(this.faker.definitions.location.postcode); + if (typeof format === 'string') { format = [format]; } diff --git a/test/__snapshots__/locale-data.spec.ts.snap b/test/__snapshots__/locale-data.spec.ts.snap index 217a06fde79..9859a956911 100644 --- a/test/__snapshots__/locale-data.spec.ts.snap +++ b/test/__snapshots__/locale-data.spec.ts.snap @@ -8,7 +8,7 @@ exports[`locale-data > should only have known characters 1`] = ` "base": " ()+,-./:;ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz", "bn_BD": " (),-ঁংঅআইঈউএওকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ািীুূৃেৈোৌ্ড়য়", "cs_CZ": " #()+-.ABCDEFGHIJKLMNOPRSTUVWXZabcdefghijklmnopqrstuvwxyzÁÍÚáéíóöúüýČčĎďěňŘřŠšťůűŽž", - "cy": " ,-ABCDEFGHILMNOPRSTWYabcdefghijklmnoprstuwyôŵ", + "cy": " #,-?ABCDEFGHILMNOPRSTWYabcdefghijklmnoprstuwyôŵ", "da": " !"#()+,-./ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwxyzÅÆØãåæçéíø", "de": " #&'()+,-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÄÖÜßàãäéíöúü", "de_AT": " #&()+,-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÄÖÜßãäéíöúü",