File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
WooCommerce/WooCommerceTests/ViewRelated/Bookings Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -357,4 +357,31 @@ final class BookingDetailsViewModelTests: XCTestCase {
357357
358358 XCTAssertFalse ( containsAttendanceSection)
359359 }
360+
361+ func test_view_order_is_hidden_when_booking_order_id_is_invalid( ) {
362+ // Given
363+ let booking = Booking . fake ( ) . copy (
364+ orderID: 0
365+ )
366+
367+ // When
368+ let viewModel = BookingDetailsViewModel ( booking: booking, stores: storesManager)
369+
370+ // Then
371+ let paymentSection = viewModel. sections. first { section in
372+ if case . payment = section. content {
373+ return true
374+ }
375+ return false
376+ }
377+
378+ guard let paymentSection = paymentSection,
379+ case let . payment( paymentContent) = paymentSection. content else {
380+ XCTFail ( " Payment section not found " )
381+ return
382+ }
383+
384+ XCTAssertFalse ( viewModel. isViewOrderAvailable)
385+ XCTAssertFalse ( paymentContent. actions. contains ( . viewOrder) )
386+ }
360387}
You can’t perform that action at this time.
0 commit comments