Skip to content

Commit

Permalink
Replace faker.address with faker.location
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwhatley committed Jul 17, 2024
1 parent 26dc4ce commit 744345d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions app/data/generators/contact-details.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
const { fakerUK: fakerFR } = require('@faker-js/faker')
const { fakerFR: fakerFR } = require('@faker-js/faker')
const { fakerUK: faker } = require('@faker-js/faker')


module.exports = (personalDetails) => {
let address, internationalAddress = undefined
let county = undefined // faker.address.county()
let county = undefined // faker.location.county()

if (personalDetails.isInternationalTrainee) {
internationalAddress = `${fakerFR.address.streetAddress()}
${fakerFR.address.city()}
${fakerFR.address.state()}
${fakerFR.address.zipCode()}`
internationalAddress = `${fakerFR.location.streetAddress()}
${fakerFR.location.city()}
${fakerFR.location.state()}
${fakerFR.location.zipCode()}`
}
else {

address = {
line1: faker.address.streetAddress(),
line1: faker.location.streetAddress(),
line2: '',
level2: faker.address.city(),
level1: personalDetails.isInternationalTrainee ? faker.address.state() : county,
postcode: faker.address.zipCode(),
level2: faker.location.city(),
level1: personalDetails.isInternationalTrainee ? faker.location.state() : county,
postcode: faker.location.zipCode(),
...(personalDetails.isInternationalTrainee && { country: 'France' })
}
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-schools.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ const generateSchool = (params = {}) => {
let ukprn, addressLine1, town, postcode

if (hasAddress) {
addressLine1 = params.addressLine1 || faker.address.streetAddress()
addressLine1 = params.addressLine1 || faker.location.streetAddress()
town = params.town || weighted.select(placesData.weightedCities)
let fakePostcode = faker.address.zipCode()
let fakePostcode = faker.location.zipCode()
if (town == "London"){
fakePostcode = fakePostcode.split(" ").pop()
fakePostcode = `${faker.helpers.arrayElement(cardinalDirections)}${faker.number.int({min: 1, max: 20})} ${fakePostcode}`
Expand Down

0 comments on commit 744345d

Please sign in to comment.