Remove obsolete Livewire fuel search components and consolidate pricing tiers
- Delete unused Livewire Search test and fuel type select Blade component - Move subscription webhook listener from EventServiceProvider to AppServiceProvider - Add FUEL_TYPES global config to app layout for client-side use - Add Billable trait to User model and include email_verified_at in fillable - Implement monthly/annual cadence toggle with pricing display and smart CTA routing on homepage - Update VerifyApiKeyMiddlewareTest to use e10 instead of petrol - Refactor PollFuelPrices to auto-refresh stale stations based on last_seen_at - Add incremental polling with cached timestamp and effective-start-timestamp param to FuelPriceService - Normalize amenities/fuel_types from API objects to flat arrays, skip stations missing required fields - Log response body on API failures in ApiLogger - Default homepage sort to 'reliable' instead of 'price'
This commit is contained in:
@@ -2,27 +2,22 @@
|
||||
|
||||
use App\Enums\FuelType;
|
||||
|
||||
it('resolves diesel alias to B7Standard', function () {
|
||||
expect(FuelType::fromAlias('diesel'))->toBe(FuelType::B7Standard);
|
||||
it('maps UK API uppercase values to the canonical lowercase enum', function () {
|
||||
expect(FuelType::fromApiValue('E10'))->toBe(FuelType::E10)
|
||||
->and(FuelType::fromApiValue('B7_STANDARD'))->toBe(FuelType::B7Standard)
|
||||
->and(FuelType::fromApiValue('HVO'))->toBe(FuelType::Hvo);
|
||||
});
|
||||
|
||||
it('resolves petrol alias to E10', function () {
|
||||
expect(FuelType::fromAlias('petrol'))->toBe(FuelType::E10);
|
||||
it('accepts already-lowercase values', function () {
|
||||
expect(FuelType::fromApiValue('e5'))->toBe(FuelType::E5);
|
||||
});
|
||||
|
||||
it('resolves unleaded alias to E10', function () {
|
||||
expect(FuelType::fromAlias('unleaded'))->toBe(FuelType::E10);
|
||||
it('exposes a human label for each case', function () {
|
||||
expect(FuelType::E10->label())->toBe('Petrol (E10)')
|
||||
->and(FuelType::B7Standard->label())->toBe('Diesel (B7)')
|
||||
->and(FuelType::Hvo->label())->toBe('HVO');
|
||||
});
|
||||
|
||||
it('resolves premium_unleaded alias to E5', function () {
|
||||
expect(FuelType::fromAlias('premium_unleaded'))->toBe(FuelType::E5);
|
||||
});
|
||||
|
||||
it('accepts canonical enum values as aliases', function () {
|
||||
expect(FuelType::fromAlias('e10'))->toBe(FuelType::E10);
|
||||
expect(FuelType::fromAlias('b7_standard'))->toBe(FuelType::B7Standard);
|
||||
});
|
||||
|
||||
it('throws ValueError for unknown alias', function () {
|
||||
FuelType::fromAlias('avgas');
|
||||
it('throws ValueError for unknown fuel types', function () {
|
||||
FuelType::fromApiValue('avgas');
|
||||
})->throws(ValueError::class);
|
||||
|
||||
Reference in New Issue
Block a user