mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
fix notification chanels and more tests (#108)
* fix notification chanels and more tests * fix code style
This commit is contained in:
67
tests/Feature/ServerProvidersTest.php
Normal file
67
tests/Feature/ServerProvidersTest.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\ServerProvider;
|
||||
use App\Http\Livewire\ServerProviders\ConnectProvider;
|
||||
use App\Http\Livewire\ServerProviders\ProvidersList;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ServerProvidersTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_connect_hetzner(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
Http::fake();
|
||||
|
||||
Livewire::test(ConnectProvider::class)
|
||||
->set('provider', ServerProvider::HETZNER)
|
||||
->set('name', 'profile')
|
||||
->set('token', 'token')
|
||||
->call('connect')
|
||||
->assertSuccessful();
|
||||
|
||||
$this->assertDatabaseHas('server_providers', [
|
||||
'provider' => ServerProvider::HETZNER,
|
||||
'profile' => 'profile',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_see_providers_list(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$provider = \App\Models\ServerProvider::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
Livewire::test(ProvidersList::class)
|
||||
->assertSee([
|
||||
$provider->profile,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_delete_provider(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$provider = \App\Models\ServerProvider::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
Livewire::test(ProvidersList::class)
|
||||
->set('deleteId', $provider->id)
|
||||
->call('delete')
|
||||
->assertSuccessful();
|
||||
|
||||
$this->assertDatabaseMissing('server_providers', [
|
||||
'id' => $provider->id,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user