File: D:/HostingSpaces/SBogers10/shop.komma.nl/tests/Cypress/support/g11n_and_address_service.js
import faker from "faker";
export class G11nAccountService {
static makeAddress() {
return {
street: faker.address.streetAddress(),
house_number: faker.random.number(),
postal_code: faker.address.zipCode(),
city: faker.address.city(),
country_iso3: G11nAccountService.randomCountryIso3()
}
}
static makeUser() {
return {
first_name: faker.name.firstName(),
last_name_prefix: faker.random.arrayElement(["de", "het", "ten", "van", "van de", "van den", "van der", "van het", "", "", "", "", "", ""]),
last_name: faker.name.lastName(),
email: faker.internet.email(),
telephone: faker.phone.phoneNumber(),
};
}
static randomCountryIso3() {
return faker.random.arrayElement(Countries.reduce((iso3Array, country) => {
iso3Array.push(country.ThreeLetterISORegionName)
return iso3Array;
}, []));
}
static nativeCountryNameByIso3(iso3) {
let country = Countries.find((country) => {
return country.ThreeLetterISORegionName === iso3;
})
return (country) ? country.NativeName : ''
}
}
//See Countries.php dataset in kms core from which this data is an excerpt from.
const Countries = [
{
NativeName: 'Nederland',
ThreeLetterISORegionName: 'NLD'
},
{
NativeName: 'Belgiƫ',
ThreeLetterISORegionName: 'BEL'
},
{
NativeName: 'United Kingdom',
ThreeLetterISORegionName: 'GBR'
},
{
NativeName: 'Deutschland',
ThreeLetterISORegionName: 'DEU'
},
]