Skip to content

Commit

Permalink
chore(faker): fix deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
anehx committed Jun 20, 2023
1 parent 5b3b0ab commit 88cc66d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/-ember-caluma/mirage/factories/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { faker } from "@faker-js/faker";
import { Factory } from "miragejs";

export default Factory.extend({
firstName: () => faker.name.firstName(),
lastName: () => faker.name.lastName(),
firstName: () => faker.person.firstName(),
lastName: () => faker.person.lastName(),
});
4 changes: 2 additions & 2 deletions packages/testing/addon-mirage-support/factories/answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default Factory.extend({

if (answer.value === undefined) {
answer.update({
value: faker.datatype.number({
value: faker.number.int({
min: answer.question.minValue,
max: answer.question.maxValue,
}),
Expand All @@ -32,7 +32,7 @@ export default Factory.extend({

if (answer.value === undefined) {
answer.update({
value: faker.datatype.number({
value: faker.number.int({
min: answer.question.minValue,
max: answer.question.maxValue,
precision: 0.1,
Expand Down
8 changes: 4 additions & 4 deletions packages/testing/addon-mirage-support/factories/question.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ export default Factory.extend({
if (["TEXT", "TEXTAREA"].includes(question.type)) {
if (question.maxLength === undefined) {
question.update({
maxLength: faker.datatype.number({ min: 1, max: 255 }),
maxLength: faker.number.int({ min: 1, max: 255 }),
});
}
if (question.minLength === undefined) {
question.update({
minLength: faker.datatype.number({ min: 1, max: 10 }),
minLength: faker.number.int({ min: 1, max: 10 }),
});
}
} else if (["INTEGER", "FLOAT"].includes(question.type)) {
if (question.minValue === undefined) {
question.update({
minValue: faker.datatype.number({ min: 1, max: 100 }),
minValue: faker.number.int({ min: 1, max: 100 }),
});
}

if (question.maxValue === undefined) {
question.update({
maxValue: faker.datatype.number({
maxValue: faker.number.int({
min: question.minValue + 1,
max: 1000,
}),
Expand Down

0 comments on commit 88cc66d

Please sign in to comment.