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 71b32ba commit 0467eb9
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/models/overtimereduced.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@ import { faker } from "@faker-js/faker";
import { OvertimereducedRow } from "./overtimereduced.js";
import { isoDateFromDateTime } from "../lib/dateTime.js";

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

export const createOvertimereducedMocks = ({
count = 1,
usersId = 0,
usersIdAdded = 1,
}: { count?: number; usersId?: number; usersIdAdded?: number } = {}) => {
hoursMinMax = [0, 100],
}: Options = {}) => {
return Array.from({ length: count }, (_, index): OvertimereducedRow => {
return {
id: index,
usersId,
usersIdAdded,
usersId: 0,
usersIdAdded: 1,
dateAdded: isoDateFromDateTime(faker.date.past()),
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],
}),
createdAfterEndOfMonth: faker.datatype.boolean(),
};
});
Expand Down

0 comments on commit 0467eb9

Please sign in to comment.