Skip to content

Commit

Permalink
adjusted mock creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dsumer committed Oct 19, 2023
1 parent dad018c commit 367a3d5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/models/overtimecarry.mocks.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import { faker } from "@faker-js/faker";
import { OvertimecarryRow } from "./overtimecarry.js";

type Options = {
count?: number;
hoursMinMax?: [number, number];
yearMinMax?: [number, number];
};

export const createOvertimecarryMocks = ({
count = 1,
usersId = 0,
}: { count?: number; usersId?: number } = {}) => {
hoursMinMax = [0, 100],
yearMinMax = [1900, 2024],
}: Options = {}) => {
return Array.from({ length: count }, (): OvertimecarryRow => {
return {
usersId,
year: faker.datatype.number({ min: 1900, max: 2024 }),
usersId: 0,
year: faker.datatype.number({ min: yearMinMax[0], max: yearMinMax[1] }),
note: faker.datatype.boolean() ? faker.lorem.sentences(2) : null,
hours: faker.datatype.number({ min: 0, max: 100 }),
hours: faker.datatype.number({
min: hoursMinMax[0],
max: hoursMinMax[1],
}),
};
});
};

0 comments on commit 367a3d5

Please sign in to comment.