Skip to content
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 tests for booking flow #17

Merged
merged 2 commits into from
Jan 15, 2024
Merged

Add tests for booking flow #17

merged 2 commits into from
Jan 15, 2024

Conversation

zzat
Copy link
Collaborator

@zzat zzat commented Jan 13, 2024

Addresses: #5

@zzat zzat requested a review from olttwa January 13, 2024 09:54
:reservation_expiration_time [:cast (.toString reservation-expiration-time) :timestamptz]}
:where [:in :ticket_id ticket-ids]})))
(let [expiration-time
(if (nil? reservation-expiration-time)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change if to and

(let [{:keys [status response]} (reserve-tickets (inc total-tickets))
booking-id (get-booking-id response)]
(is (= 201 status))
(Thread/sleep 2000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 ways to test an async function:

  1. Make the async part synchronous only for the tests using some config.
  2. Poll from the test and the polling fn fulfils the promise.

@zzat zzat merged commit f57ab49 into main Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants