increase test coverage (#117)

70% test coverage
remove socialite
This commit is contained in:
Saeed Vaziry
2024-03-15 22:23:45 +01:00
committed by GitHub
parent 4f12de9586
commit a406491160
62 changed files with 1102 additions and 639 deletions

View File

@ -5,7 +5,6 @@
use App\Models\SourceControl;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use JsonException;
use Tests\TestCase;
class SourceControlsTest extends TestCase
@ -14,8 +13,6 @@ class SourceControlsTest extends TestCase
/**
* @dataProvider data
*
* @throws JsonException
*/
public function test_connect_provider(string $provider, ?string $customUrl): void
{
@ -43,8 +40,6 @@ public function test_connect_provider(string $provider, ?string $customUrl): voi
/**
* @dataProvider data
*
* @throws JsonException
*/
public function test_delete_provider(string $provider): void
{
@ -64,6 +59,33 @@ public function test_delete_provider(string $provider): void
]);
}
/**
* @dataProvider data
*/
public function test_cannot_delete_provider(string $provider): void
{
$this->actingAs($this->user);
/** @var SourceControl $sourceControl */
$sourceControl = SourceControl::factory()->create([
'provider' => $provider,
'profile' => 'test',
]);
$this->site->update([
'source_control_id' => $sourceControl->id,
]);
$this->delete(route('source-controls.delete', $sourceControl->id))
->assertSessionDoesntHaveErrors()
->assertSessionHas('toast.type', 'error')
->assertSessionHas('toast.message', 'This source control is being used by a site.');
$this->assertDatabaseHas('source_controls', [
'id' => $sourceControl->id,
]);
}
public static function data(): array
{
return [