mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-03-14 20:33:40 +00:00
fix: enable backwards compatibility v1 rendering strategy
Some checks failed
tests / ci (push) Has been cancelled
Some checks failed
tests / ci (push) Has been cancelled
This commit is contained in:
parent
5eb442d9d6
commit
b8b6caba12
4 changed files with 45 additions and 6 deletions
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -824,7 +824,7 @@ test('plugin duplicate copies all attributes except id and uuid', function (): v
|
|||
|
||||
expect($duplicate->id)->not->toBe($original->id)
|
||||
->and($duplicate->uuid)->not->toBe($original->uuid)
|
||||
->and($duplicate->name)->toBe('Original Plugin (Copy)')
|
||||
->and($duplicate->name)->toBe('Original Plugin_copy')
|
||||
->and($duplicate->user_id)->toBe($original->user_id)
|
||||
->and($duplicate->data_stale_minutes)->toBe($original->data_stale_minutes)
|
||||
->and($duplicate->data_strategy)->toBe($original->data_strategy)
|
||||
|
|
@ -859,7 +859,7 @@ test('plugin duplicate sets trmnlp_id to null to avoid unique constraint violati
|
|||
|
||||
expect($duplicate->trmnlp_id)->toBeNull()
|
||||
->and($original->trmnlp_id)->toBe('test-trmnlp-id-123')
|
||||
->and($duplicate->name)->toBe('Plugin with trmnlp_id (Copy)');
|
||||
->and($duplicate->name)->toBe('Plugin with trmnlp_id_copy');
|
||||
});
|
||||
|
||||
test('plugin duplicate copies render_markup_view file content to render_markup', function (): void {
|
||||
|
|
@ -890,7 +890,7 @@ test('plugin duplicate copies render_markup_view file content to render_markup',
|
|||
expect($duplicate->render_markup)->toBe($testContent)
|
||||
->and($duplicate->markup_language)->toBe('blade')
|
||||
->and($duplicate->render_markup_view)->toBeNull()
|
||||
->and($duplicate->name)->toBe('View Plugin (Copy)');
|
||||
->and($duplicate->name)->toBe('View Plugin_copy');
|
||||
} finally {
|
||||
// Clean up test file
|
||||
if (file_exists($testViewPath)) {
|
||||
|
|
@ -949,7 +949,7 @@ test('plugin duplicate handles missing view file gracefully', function (): void
|
|||
$duplicate = $original->duplicate();
|
||||
|
||||
expect($duplicate->render_markup_view)->toBeNull()
|
||||
->and($duplicate->name)->toBe('Missing View Plugin (Copy)');
|
||||
->and($duplicate->name)->toBe('Missing View Plugin_copy');
|
||||
});
|
||||
|
||||
test('plugin duplicate uses provided user_id', function (): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue