Skip to content

Commit

Permalink
test(bookings): test visitor checking flow
Browse files Browse the repository at this point in the history
  • Loading branch information
chillfox committed Aug 20, 2024
1 parent 5a78af9 commit 2dc4522
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spec/controllers/bookings_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,13 @@ describe Bookings do

context "[visitor-kiosk]", tags: ["visitor-kiosk"] do
it "checks in a visitor" do
WebMock.stub(:post, "#{ENV["PLACE_URI"]}/auth/oauth/token")
.to_return(body: File.read("./spec/fixtures/tokens/placeos_token.json"))
WebMock.stub(:post, "#{ENV["PLACE_URI"]}/api/engine/v2/signal?channel=staff/booking/changed")
.to_return(body: "")
WebMock.stub(:post, "#{ENV["PLACE_URI"]}/api/engine/v2/signal?channel=staff/guest/attending")
.to_return(body: "")

tenant = get_tenant

starting = Random.new.rand(5..19).minutes.from_now.to_unix
Expand All @@ -2255,15 +2262,15 @@ describe Bookings do
}]})
)
create_booking_response.status_code.should eq(201)
booking = Booking.from_json(create_booking_response.body)
booking_id = JSON.parse(create_booking_response.body)["id"]

# Find guest by email
guest_response = client.get("#{GUESTS_BASE}/#{visitor_email}", headers: headers)
guest_response.status_code.should eq(200)
guest_id = JSON.parse(guest_response.body)["id"]

# update induction state on booking
update_induction_response = client.post("#{BOOKINGS_BASE}/#{booking.id}/update_induction?induction=ACCEPTED", headers: headers)
update_induction_response = client.post("#{BOOKINGS_BASE}/#{booking_id}/update_induction?induction=accepted", headers: headers)
update_induction_response.status_code.should eq(200)
booking = Booking.from_json(update_induction_response.body)
booking.induction.should eq(PlaceOS::Model::Booking::Induction::ACCEPTED)
Expand Down

0 comments on commit 2dc4522

Please sign in to comment.