Now that only the outbound leg gets a row, its Price column showed just that leg's price, silently missing the return leg's half. It now sums both legs (bcadd, 2dp) for a round trip, with a breakdown shown underneath; unchanged for one-way bookings.
This commit is contained in:
@@ -360,6 +360,26 @@ test('a round trip\'s return leg has no row of its own in the list, only its out
|
||||
->assertCanNotSeeTableRecords([$return]);
|
||||
});
|
||||
|
||||
test('a round trip\'s price column shows both legs combined', function () {
|
||||
$outbound = Booking::factory()->create(['is_return_leg' => false, 'price' => 15000]);
|
||||
$return = Booking::factory()->create([
|
||||
'is_return_leg' => true,
|
||||
'linked_booking_id' => $outbound->id,
|
||||
'price' => 20000,
|
||||
]);
|
||||
$outbound->update(['linked_booking_id' => $return->id]);
|
||||
|
||||
Livewire::test(ListBookings::class)
|
||||
->assertTableColumnStateSet('price', '35000.00', record: $outbound);
|
||||
});
|
||||
|
||||
test('a one-way booking\'s price column shows just its own price', function () {
|
||||
$booking = Booking::factory()->create(['is_return_leg' => false, 'linked_booking_id' => null, 'price' => 15000]);
|
||||
|
||||
Livewire::test(ListBookings::class)
|
||||
->assertTableColumnStateSet('price', '15000.00', record: $booking);
|
||||
});
|
||||
|
||||
test('the restore action is only visible for a trashed booking', function () {
|
||||
$active = Booking::factory()->create();
|
||||
$deleted = Booking::factory()->create();
|
||||
|
||||
Reference in New Issue
Block a user