Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

test(source): cover deleting an incomplete github app

Andras Bacsaif8eb6f725e86
diff --git a/tests/Feature/Application/GithubSourceChangeTest.php b/tests/Feature/Application/GithubSourceChangeTest.php
index c3912ead7d..c42139c396 100644
--- a/tests/Feature/Application/GithubSourceChangeTest.php
+++ b/tests/Feature/Application/GithubSourceChangeTest.php
@@ -62,6 +62,30 @@ describe('GitHub Source Change Component', function () {
expect($missingAuthorization)->toBeEmpty();
});
+ test('deletes an incomplete github app and redirects without a render error', function () {
+ $githubApp = GithubApp::create([
+ 'name' => 'Incomplete GitHub App',
+ 'organization' => 'coollabsio',
+ 'api_url' => 'https://api.github.com',
+ 'html_url' => 'https://github.com',
+ 'custom_user' => 'git',
+ 'custom_port' => 22,
+ 'team_id' => $this->team->id,
+ 'is_system_wide' => false,
+ ]);
+
+ Livewire::withQueryParams(['github_app_uuid' => $githubApp->uuid])
+ ->test(Change::class)
+ ->assertSee('Incomplete GitHub App')
+ ->call('delete')
+ ->assertHasNoErrors()
+ ->assertRedirect(route('source.all'))
+ ->assertSet('github_app', null)
+ ->call('$refresh');
+
+ expect(GithubApp::find($githubApp->id))->toBeNull();
+ });
+
test('can mount with newly created github app with null app_id', function () {
// Create a GitHub app without app_id (simulating a newly created source)
$githubApp = GithubApp::create([