Skip to content

Commit

Permalink
fix: Incorrect absence mock
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnns committed Mar 11, 2022
1 parent 4b3565f commit 979266d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/models/absence.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ const ONE_DAY = 24 * 60 * 60 * 1000;
const absenceStatuses = Object.values(AbsenceStatus).filter(
(status): status is AbsenceStatus => typeof status === "number"
);
const absenceTypes = Object.values(AbsenceType).filter(
(status): status is AbsenceType => typeof status === "number"
const absenceTypesWithoutOvertimeReduction = Object.values(AbsenceType).filter(
(status): status is AbsenceType =>
typeof status === "number" && status !== AbsenceType.ReductionOfOvertime
);

export const createAbsencesMocks = ({
Expand Down Expand Up @@ -61,7 +62,9 @@ export const createAbsencesMocks = ({
? AbsenceType.ReductionOfOvertime
: // Make sure that we get the most important absence types
// also for lower mock counts.
absenceTypes[index % absenceTypes.length],
absenceTypesWithoutOvertimeReduction[
index % absenceTypesWithoutOvertimeReduction.length
],
note: hasNote
? faker.lorem.words(faker.datatype.number({ min: 2, max: 10 }))
: null,
Expand Down

0 comments on commit 979266d

Please sign in to comment.