fix: enable backwards compatibility v1 rendering strategy
Some checks failed
tests / ci (push) Has been cancelled

This commit is contained in:
Benjamin Nussbaum 2026-02-21 11:34:30 +01:00
parent 5eb442d9d6
commit b8b6caba12
4 changed files with 45 additions and 6 deletions

View file

@ -3,6 +3,7 @@
declare(strict_types=1);
use App\Models\DeviceModel;
use Illuminate\Support\Facades\Config;
test('device model has required attributes', function (): void {
$deviceModel = DeviceModel::factory()->create([
@ -117,3 +118,27 @@ test('device model factory creates valid data', function (): void {
expect($deviceModel->offset_x)->toBeInt();
expect($deviceModel->offset_y)->toBeInt();
});
test('css_name returns og when puppeteer_window_size_strategy is v1', function (): void {
Config::set('app.puppeteer_window_size_strategy', 'v1');
$deviceModel = DeviceModel::factory()->create(['css_name' => 'my_device']);
expect($deviceModel->css_name)->toBe('og');
});
test('css_name returns db value when puppeteer_window_size_strategy is v2', function (): void {
Config::set('app.puppeteer_window_size_strategy', 'v2');
$deviceModel = DeviceModel::factory()->create(['css_name' => 'my_device']);
expect($deviceModel->css_name)->toBe('my_device');
});
test('css_name returns null when puppeteer_window_size_strategy is v2 and db value is null', function (): void {
Config::set('app.puppeteer_window_size_strategy', 'v2');
$deviceModel = DeviceModel::factory()->create(['css_name' => null]);
expect($deviceModel->css_name)->toBeNull();
});