From 4ce62331f962296f23c2d9e3f6e4ccc369eab49f Mon Sep 17 00:00:00 2001 From: jerremyng Date: Sun, 4 Jan 2026 14:01:57 +0000 Subject: [PATCH] change tests to test model/plugin logic directly Previously it was testing the rendered frontend, now it ensures no malicious xss is saved --- tests/Unit/Models/PluginTest.php | 118 +++++++++---------------------- 1 file changed, 32 insertions(+), 86 deletions(-) diff --git a/tests/Unit/Models/PluginTest.php b/tests/Unit/Models/PluginTest.php index 49d3f2e..b42668d 100644 --- a/tests/Unit/Models/PluginTest.php +++ b/tests/Unit/Models/PluginTest.php @@ -4,12 +4,8 @@ use App\Models\Plugin; use App\Models\User; use Carbon\Carbon; use Illuminate\Support\Facades\Http; -use Livewire\Volt\Volt; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Tests\TestCase; - -uses(TestCase::class,RefreshDatabase::class); +uses(Illuminate\Foundation\Testing\RefreshDatabase::class); test('plugin has required attributes', function (): void { $plugin = Plugin::factory()->create([ @@ -684,56 +680,25 @@ test('plugin render includes utc_offset and time_zone_iana in trmnl.user context ->and($rendered)->toMatch('/\|-?\d+/'); // Should contain a pipe followed by a number (offset in seconds) }); - /** * Plugin security: XSS Payload Dataset - * [Input, Expected to See, Dangerous parts that must be Missing] + * [Input, Expected Result, Forbidden String] */ dataset('xss_vectors', [ - 'standard_script' => [ - 'Safe ', - 'Safe', - ['', - 'Unclosed tag', - ['', 'Safe ', '