-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
50 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,26 +10,28 @@ import { Timestamp } from "firebase-admin/firestore" | |
|
||
const eventService = new EventService() | ||
|
||
const startDate = dateToFirestoreTimeStamp(new Date(2024, 1, 1)) | ||
const endDate = dateToFirestoreTimeStamp(new Date(2024, 1, 2)) | ||
const startDate = new Date(2024, 1, 1) | ||
const endDate = new Date(2024, 1, 2) | ||
const startTimestamp = dateToFirestoreTimeStamp(startDate) | ||
const endTimestamp = dateToFirestoreTimeStamp(endDate) | ||
|
||
const laterStartDate = dateToFirestoreTimeStamp(new Date(2024, 2, 2)) | ||
|
||
const event1: Event = { | ||
title: "UASC new event", | ||
description: "Grand opening of the website.", | ||
location: "Virtual pizza event", | ||
physical_start_date: startDate, | ||
start_date: startDate, | ||
end_date: endDate | ||
physical_start_date: startTimestamp, | ||
start_date: startTimestamp, | ||
end_date: endTimestamp | ||
} | ||
const event2: Event = { | ||
title: "Snowboard racing", | ||
description: "Race and see who's the fastest!", | ||
location: "Snowsport club", | ||
physical_start_date: startDate, | ||
start_date: startDate, | ||
end_date: endDate | ||
physical_start_date: startTimestamp, | ||
start_date: startTimestamp, | ||
end_date: endTimestamp | ||
} | ||
const now = new Date(Date.now()) | ||
const futureEvent: Event = { | ||
|
@@ -46,13 +48,15 @@ const reservation1: EventReservation = { | |
first_name: "John", | ||
last_name: "Appleseed", | ||
email: "[email protected]", | ||
is_member: true | ||
is_member: true, | ||
timestamp: Timestamp.fromDate(startDate) | ||
} | ||
const reservation2: EventReservation = { | ||
first_name: "Jane", | ||
last_name: "Pearseed", | ||
email: "[email protected]", | ||
is_member: false | ||
is_member: false, | ||
timestamp: Timestamp.fromDate(startDate) | ||
} | ||
|
||
describe("EventService integration tests", () => { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ const event2: Event = { | |
start_date: startDate, | ||
end_date: endDate | ||
} | ||
const reservation1: EventReservation = { | ||
const reservation1: Omit<EventReservation, "timestamp"> = { | ||
first_name: "John", | ||
last_name: "Doe", | ||
email: "[email protected]", | ||
|
@@ -88,7 +88,10 @@ describe("EventController endpoint tests", () => { | |
|
||
it("should return 400 if already signed up to event", async () => { | ||
const event = await eventService.createEvent(event1) | ||
await eventService.addReservation(event.id, reservation1) | ||
await eventService.addReservation(event.id, { | ||
...reservation1, | ||
timestamp: Timestamp.now() | ||
}) | ||
const res = await request.post("/events/signup").send({ | ||
event_id: event.id, | ||
reservation: reservation1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters