feat: extract fuel.map component and wire Leaflet to map-update browser event
This commit is contained in:
33
tests/Feature/Livewire/Fuel/MapTest.php
Normal file
33
tests/Feature/Livewire/Fuel/MapTest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use App\Livewire\Public\Fuel\Map;
|
||||
use Livewire\Livewire;
|
||||
|
||||
it('renders the map component', function () {
|
||||
Livewire::test(Map::class)
|
||||
->assertStatus(200);
|
||||
});
|
||||
|
||||
it('dispatches map-update browser event when stations-found is received', function () {
|
||||
Livewire::test(Map::class)
|
||||
->dispatch('stations-found',
|
||||
results: [['name' => 'BP Garage']],
|
||||
meta: ['lat' => 51.5, 'lng' => -0.1, 'count' => 1],
|
||||
radius: 5,
|
||||
prediction: null
|
||||
)
|
||||
->assertDispatched('map-update');
|
||||
});
|
||||
|
||||
it('passes radius in map-update payload', function () {
|
||||
Livewire::test(Map::class)
|
||||
->dispatch('stations-found',
|
||||
results: [],
|
||||
meta: ['lat' => 51.5, 'lng' => -0.1, 'count' => 0],
|
||||
radius: 10,
|
||||
prediction: null
|
||||
)
|
||||
->assertDispatched('map-update', fn ($event, $params) =>
|
||||
$params['radius'] === 10
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user