-
Notifications
You must be signed in to change notification settings - Fork 8
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
HRIS-379 [BE] API for My Daily Time Record > Index #319
Conversation
it('should be defined', () => { | ||
expect(resolver).toBeDefined(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this testing is useless, it only checks resolver if defined or undefined in this testcase
You can do:
- delete this test file
OR
- or create a new test case that is doing api integration testing that checks returned key valued pairs data.
const mappedTimesheet: TimeEntryDTO = { | ||
user: timeEntry.user, | ||
startTime: timeEntry.startTime ? | ||
timeEntry.startTime.toISOString().slice(11, 19) | ||
: null, | ||
endTime: timeEntry.endTime ? | ||
timeEntry.endTime.toISOString().slice(11, 19) | ||
: null, | ||
workedHours: timeEntry.workedHours || null, | ||
trackedHours: timeEntry.trackedHours || null, | ||
timeIn: timeEntry.timeIn || null, | ||
timeOut: timeEntry.timeOut || null, | ||
date: timeEntry.date, | ||
late: late, | ||
undertime: undertime, | ||
eslChangeShift: timeEntry.eslChangeShiftRequests.length === 0 ? | ||
null | ||
: timeEntry.eslChangeShiftRequests, | ||
status: workStatus, | ||
isLeaderApproved: timeEntry.overtime?.isLeaderApproved || null, | ||
changeShift: timeEntry.changeShiftRequest || null, | ||
id: timeEntry.id, | ||
userId: timeEntry.userId, | ||
timeInId: timeEntry.timeInId || null, | ||
timeOutId: timeEntry.timeOutId || null, | ||
breakStartTime: timeEntry.breakStartTime, | ||
breakEndTime: timeEntry.breakEndTime, | ||
overtime: timeEntry.overtime || null, | ||
changeShiftRequest: timeEntry.changeShiftRequest || null, | ||
workInterruptions: timeEntry.workInterruptions, | ||
eslOffsets: timeEntry.eslOffsets || null, | ||
createdAt: timeEntry.createdAt || null, | ||
updatedAt: timeEntry.updatedAt || null | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to map all of the fields? its not efficient
Isn't the default value null if there's no data?
you can also do this:
const formatTime = (time) => time ? time.toISOString().slice(11, 19) : null;
return {
...timeEntry,
// below fields that needs calculation like below
startTime: formatTime(timeEntry.startTime),
endTime: formatTime(timeEntry.endTime),
}
Issue Link
https://framgiaph.backlog.com/view/HRIS-379
Definition of Done
Notes
Pre-condition
Db has to be running
Commands to run
npm run dev
Expected Output
It should show user's time entries and user details
Screenshots/Recordings
TimeEntriesByEmployeeId query
UserbyId query