Migrate to HTMX (#114)

Dropped Livewire
Added HTMX
Added Blade code lint
Drop Mysql and Redis
Migrate to SQLite
This commit is contained in:
Saeed Vaziry
2024-03-06 17:02:59 +01:00
committed by GitHub
parent 5b2c419e91
commit b2083fc6b2
486 changed files with 8609 additions and 8707 deletions

View File

@ -3,11 +3,9 @@
namespace Tests\Feature;
use App\Enums\CronjobStatus;
use App\Http\Livewire\Cronjobs\CreateCronjob;
use App\Http\Livewire\Cronjobs\CronjobsList;
use App\Facades\SSH;
use App\Models\CronJob;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;
class CronjobTest extends TestCase
@ -23,12 +21,14 @@ public function test_see_cronjobs_list()
'server_id' => $this->server->id,
]);
Livewire::test(CronjobsList::class, ['server' => $this->server])
$this->get(route('servers.cronjobs', $this->server))
->assertSeeText($cronjob->frequency_label);
}
public function test_delete_cronjob()
{
SSH::fake();
$this->actingAs($this->user);
/** @var CronJob $cronjob */
@ -36,29 +36,34 @@ public function test_delete_cronjob()
'server_id' => $this->server->id,
]);
Livewire::test(CronjobsList::class, ['server' => $this->server])
->set('deleteId', $cronjob->id)
->call('delete')
->assertDispatched('confirmed');
$this->delete(route('servers.cronjobs.destroy', [
'server' => $this->server,
'cronJob' => $cronjob,
]))->assertSessionHasNoErrors();
$this->assertDatabaseMissing('cron_jobs', [
'id' => $cronjob->id,
]);
}
public function test_create_cronjob()
{
SSH::fake();
$this->actingAs($this->user);
Livewire::test(CreateCronjob::class, ['server' => $this->server])
->set('command', 'ls -la')
->set('user', 'vito')
->set('frequency', '* * * * *')
->call('create')
->assertDispatched('created');
$this->post(route('servers.cronjobs.store', $this->server), [
'command' => 'ls -la',
'user' => 'vito',
'frequency' => '* * * * *',
])->assertSessionHasNoErrors();
$this->assertDatabaseHas('cron_jobs', [
'server_id' => $this->server->id,
'command' => 'ls -la',
'user' => 'vito',
'frequency' => '* * * * *',
'status' => CronjobStatus::CREATING,
'status' => CronjobStatus::READY,
]);
}
}