Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update usage of faker #931

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions imports/api/_dev/populate/appointments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import scheduleAppointment from '../../endpoint/appointments/schedule';
import invoke from '../../endpoint/invoke';

export const newAppointmentFormData = makeTemplate({
datetime: () => faker.date.past(20),
datetime: () => faker.date.past({years: 20}),
duration: () => 1,
reason: () => faker.lorem.sentence(),
phone: () => faker.phone.number(),
patient: {
firstname: () => faker.name.firstName(),
lastname: () => faker.name.lastName(),
firstname: () => faker.person.firstName(),
lastname: () => faker.person.lastName(),
_id: () => '?',
},
});
Expand Down
6 changes: 3 additions & 3 deletions imports/api/_dev/populate/consultations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import insertConsultation from '../../endpoint/consultations/insert';
import invoke from '../../endpoint/invoke';

export const newConsultationFormData = makeTemplate({
datetime: () => faker.date.past(20),
datetime: () => faker.date.past({years: 20}),
reason: () => faker.lorem.sentence(),
done: () => faker.lorem.paragraph(),
todo: () => faker.lorem.paragraph(),
Expand All @@ -15,9 +15,9 @@ export const newConsultationFormData = makeTemplate({
more: () => faker.lorem.paragraph(),

currency: () => 'EUR',
price: () => faker.datatype.number(150),
price: () => faker.number.int(150),
paid: () => 0,
book: () => `${faker.datatype.number(100)}`,
book: () => `${faker.number.int(100)}`,
});

export const newConsultation = async (invocation, extra?) => {
Expand Down
24 changes: 12 additions & 12 deletions imports/api/_dev/populate/patients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import invoke from '../../endpoint/invoke';
const AGE_MAX = 130;

export const newPatientFormData = makeTemplate({
niss: () => faker.datatype.uuid(),
firstname: () => faker.name.firstName(),
lastname: () => faker.name.lastName(),
niss: () => faker.string.uuid(),
firstname: () => faker.person.firstName(),
lastname: () => faker.person.lastName(),

birthdate: () => format(faker.date.past(AGE_MAX), BIRTHDATE_FORMAT),
birthdate: () => format(faker.date.past({years: AGE_MAX}), BIRTHDATE_FORMAT),
sex: () => faker.helpers.arrayElement(SEX_ALLOWED),
photo: () => '', // Could use faker.image.dataUri but this would need to put the format in the database
// because current database uses PNG by default and dataUri spits out SVG
Expand All @@ -29,9 +29,9 @@ export const newPatientFormData = makeTemplate({
ongoing: () => faker.lorem.paragraph(),
about: () => faker.lorem.paragraph(),

municipality: () => faker.address.city(),
streetandnumber: () => faker.address.streetAddress(),
zip: () => faker.address.zipCode(),
municipality: () => faker.location.city(),
streetandnumber: () => faker.location.streetAddress(),
zip: () => faker.location.zipCode(),
phone: () => faker.phone.number(),

insurances: () =>
Expand All @@ -41,17 +41,17 @@ export const newPatientFormData = makeTemplate({
displayName: faker.company.name(),
name: '',
}),
range(faker.datatype.number(2)),
range(faker.number.int(2)),
),
),
doctors: () =>
list(
map(
() => ({
displayName: `${faker.name.lastName()} ${faker.name.firstName()}`,
displayName: `${faker.person.lastName()} ${faker.person.firstName()}`,
name: '',
}),
range(faker.datatype.number(2)),
range(faker.number.int(2)),
),
),
allergies: () =>
Expand All @@ -61,11 +61,11 @@ export const newPatientFormData = makeTemplate({
displayName: faker.commerce.product(),
name: '',
}),
range(faker.datatype.number(4)),
range(faker.number.int(4)),
),
),

noshow: () => faker.datatype.number(3),
noshow: () => faker.number.int(3),
});

export const newPatient = async (invocation, extra?) => {
Expand Down
Loading