-
Notifications
You must be signed in to change notification settings - Fork 1
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
test(schedule): PNRN-49 create schedule test #14
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
30c55ee
to
3b9abad
Compare
expect(endTime).toEqual(testCreateSchedule.endTime.toISOString()); | ||
}); | ||
|
||
it('should not create schedule when availability is UNAVAILABLE', async () => { |
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.
for this test, i think we need to rediscuss the implementation details about the availabilities.
it('should update schedule', () => { | ||
availableSchedule.startTime = new Date('2022-9-2 3:00:00 PM'); | ||
availableSchedule.endTime = new Date('2022-9-2 5:00:00 PM'); | ||
|
||
return requestWithStaff | ||
.put(scheduleRoute + '/' + availableSchedule.id) | ||
.send(availableSchedule) | ||
.expect(HttpStatus.OK); | ||
}); |
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.
ing ani ra ang PUT @junix033101. basically, same siya sa POST except mag edit raka sa existing data. so pwede raka mu gamit ug data gikan sa test-data parehas aning availableSchedule
na ako gi gamit
} catch (e) { | ||
if (e instanceof NotFoundError) { | ||
throw new NotFoundException(); | ||
} | ||
} |
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.
the reason a 500
error was thrown before was because prisma does not have the same error handling as nest so we have to explicitly throw a NotFoundException
(NestJS error) when prisma throws a NotFoundError
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.
great job! nice tests ✅ ✅ ✅
const createStartTimeAfterEndTimeSched = { | ||
availability: AvailabilityEnum.AVAILABLE, | ||
startTime: new Date('2022-9-3 2:00:00 PM'), | ||
endTime: new Date('2022-9-3 1:00:00 PM'), | ||
}; |
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.
no need to change but we could put a type to this variable. so it would become
const createStartTimeAfterEndTimeSched: ScheduleDTO = ...
endTime: new Date('2022-9-2 5:00:00 PM'), | ||
}; | ||
|
||
export const createSchedule = async ( |
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.
❤️
Description
Provide a description on what was changed/added/fixed in this PR
Checklist
First, create a draft pull request. Then mark the PR as ready for review when all necessary checkbox items has been completed
Backend only