-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add generate link to book appointment #390
base: master
Are you sure you want to change the base?
Conversation
@@ -146,3 +148,11 @@ export function validateBookAppointment( | |||
appointment: appointmentToBook, | |||
}; | |||
} | |||
|
|||
function generateRandom(complexity: number = 4) { |
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 not use a library to generate UIDs?
(await request.get()) as FirebaseFirestore.QuerySnapshot<DbAppointment>; | ||
|
||
const ret = toDbAppointments(appointments); | ||
if (ret.length > 1) { |
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.
See previous comment.
throw Error("there is more then one appointment with this share link!"); | ||
} | ||
|
||
if (ret.length == 0) { |
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.
See previous comment.
request: FunctionsApi.GetSharedLinkAppointmentRequest, | ||
callerId: string | ||
): Promise<FunctionsApi.GetSharedLinkAppointmentResponse> { | ||
if (callerId !== request.donorId) { |
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.
Could this API be called by an unregistered user?
|
||
const appointment = (await callTarget()).appointment; | ||
|
||
expect(appointment).not.toBeNaN(); |
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.
Do you mean to test "not to be undefined"?
).rejects.toThrow(Error); | ||
}); | ||
|
||
test("Returns available appointments is ascending start time order", 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.
I'm not sure I understand the test title.
return appointment; | ||
} | ||
|
||
test("Not authenticated", 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.
As per previous, this should not stop users from accessing the API.
await setAppointment(appointment); | ||
return appointment; | ||
} | ||
|
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.
What about the logic test cases,
as written in getAppointmentByShareLink?
No description provided.