This commit is contained in:
@@ -41,6 +41,39 @@ test('can list ev routes', function () {
|
||||
->assertCanSeeTableRecords($routes);
|
||||
});
|
||||
|
||||
test('can filter ev routes by company, from, and to', function () {
|
||||
$companyA = EvCompany::factory()->create();
|
||||
$companyB = EvCompany::factory()->create();
|
||||
$yangon = Destination::factory()->create();
|
||||
$mandalay = Destination::factory()->create();
|
||||
$bagan = Destination::factory()->create();
|
||||
|
||||
$matching = EvRoute::factory()->create([
|
||||
'ev_company_id' => $companyA->id,
|
||||
'from_destination_id' => $yangon->id,
|
||||
'to_destination_id' => $mandalay->id,
|
||||
]);
|
||||
|
||||
$wrongCompany = EvRoute::factory()->create([
|
||||
'ev_company_id' => $companyB->id,
|
||||
'from_destination_id' => $yangon->id,
|
||||
'to_destination_id' => $mandalay->id,
|
||||
]);
|
||||
|
||||
$wrongDestination = EvRoute::factory()->create([
|
||||
'ev_company_id' => $companyA->id,
|
||||
'from_destination_id' => $yangon->id,
|
||||
'to_destination_id' => $bagan->id,
|
||||
]);
|
||||
|
||||
Livewire::test(ListEvRoutes::class)
|
||||
->filterTable('ev_company_id', $companyA->id)
|
||||
->filterTable('from_destination_id', $yangon->id)
|
||||
->filterTable('to_destination_id', $mandalay->id)
|
||||
->assertCanSeeTableRecords([$matching])
|
||||
->assertCanNotSeeTableRecords([$wrongCompany, $wrongDestination]);
|
||||
});
|
||||
|
||||
test('list shows each vehicle option price stacked, and blocked options instead of a price', function () {
|
||||
$route = EvRoute::factory()->create();
|
||||
|
||||
@@ -63,7 +96,6 @@ test('creating a route also creates all three vehicle option pricing rows, defau
|
||||
'ev_company_id' => $company->id,
|
||||
'from_destination_id' => $from->id,
|
||||
'to_destination_id' => $to->id,
|
||||
'is_round_trip' => false,
|
||||
'is_active' => false,
|
||||
'pricing' => pricingPayload(),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user