mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
parent
22a24383b2
commit
7489d85592
2 changed files with 24 additions and 6 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Livewire\Livewire;
|
||||||
use Livewire\Volt\Volt;
|
use Livewire\Volt\Volt;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
|
|
@ -16,6 +17,8 @@ it('can render catalog component', function (): void {
|
||||||
config('app.catalog_url') => Http::response('', 200),
|
config('app.catalog_url') => Http::response('', 200),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
$component = Volt::test('catalog.index');
|
$component = Volt::test('catalog.index');
|
||||||
|
|
||||||
$component->assertSee('No plugins available');
|
$component->assertSee('No plugins available');
|
||||||
|
|
@ -54,6 +57,8 @@ it('loads plugins from catalog URL', function (): void {
|
||||||
config('app.catalog_url') => Http::response($yamlContent, 200),
|
config('app.catalog_url') => Http::response($yamlContent, 200),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
$component = Volt::test('catalog.index');
|
$component = Volt::test('catalog.index');
|
||||||
|
|
||||||
$component->assertSee('Test Plugin');
|
$component->assertSee('Test Plugin');
|
||||||
|
|
@ -67,6 +72,8 @@ it('shows error when plugin not found', function (): void {
|
||||||
|
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
$component = Volt::test('catalog.index');
|
$component = Volt::test('catalog.index');
|
||||||
|
|
||||||
$component->call('installPlugin', 'non-existent-plugin');
|
$component->call('installPlugin', 'non-existent-plugin');
|
||||||
|
|
@ -97,6 +104,8 @@ it('shows error when zip_url is missing', function (): void {
|
||||||
|
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
$component = Volt::test('catalog.index');
|
$component = Volt::test('catalog.index');
|
||||||
|
|
||||||
$component->call('installPlugin', 'test-plugin');
|
$component->call('installPlugin', 'test-plugin');
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Services\PluginImportService;
|
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Livewire\Livewire;
|
||||||
use Livewire\Volt\Volt;
|
use Livewire\Volt\Volt;
|
||||||
use Mockery\MockInterface;
|
|
||||||
|
|
||||||
it('loads newest TRMNL recipes on mount', function () {
|
it('loads newest TRMNL recipes on mount', function () {
|
||||||
Http::fake([
|
Http::fake([
|
||||||
|
|
@ -24,6 +23,8 @@ it('loads newest TRMNL recipes on mount', function () {
|
||||||
], 200),
|
], 200),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
Volt::test('catalog.trmnl')
|
Volt::test('catalog.trmnl')
|
||||||
->assertSee('Weather Chum')
|
->assertSee('Weather Chum')
|
||||||
->assertSee('Install')
|
->assertSee('Install')
|
||||||
|
|
@ -61,6 +62,8 @@ it('searches TRMNL recipes when search term is provided', function () {
|
||||||
], 200),
|
], 200),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
Volt::test('catalog.trmnl')
|
Volt::test('catalog.trmnl')
|
||||||
->assertSee('Initial Recipe')
|
->assertSee('Initial Recipe')
|
||||||
->set('search', 'weather')
|
->set('search', 'weather')
|
||||||
|
|
@ -89,6 +92,8 @@ it('installs plugin successfully when user is authenticated', function () {
|
||||||
|
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
Volt::test('catalog.trmnl')
|
Volt::test('catalog.trmnl')
|
||||||
->assertSee('Weather Chum')
|
->assertSee('Weather Chum')
|
||||||
->call('installPlugin', '123')
|
->call('installPlugin', '123')
|
||||||
|
|
@ -111,6 +116,8 @@ it('shows error when user is not authenticated', function () {
|
||||||
], 200),
|
], 200),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
Volt::test('catalog.trmnl')
|
Volt::test('catalog.trmnl')
|
||||||
->assertSee('Weather Chum')
|
->assertSee('Weather Chum')
|
||||||
->call('installPlugin', '123')
|
->call('installPlugin', '123')
|
||||||
|
|
@ -138,6 +145,8 @@ it('shows error when plugin installation fails', function () {
|
||||||
|
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
|
Livewire::withoutLazyLoading();
|
||||||
|
|
||||||
Volt::test('catalog.trmnl')
|
Volt::test('catalog.trmnl')
|
||||||
->assertSee('Weather Chum')
|
->assertSee('Weather Chum')
|
||||||
->call('installPlugin', '123')
|
->call('installPlugin', '123')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue