test: cover credential-clearing and trailing-slash URL edge cases

Also fixes a missing trailing newline in SiteResource.php.
This commit is contained in:
Doar Mihai
2026-07-19 17:05:01 +03:00
parent c2ef6d9986
commit f7b71684f1
3 changed files with 40 additions and 1 deletions
+14
View File
@@ -105,3 +105,17 @@ test('WordPress app password can be revealed and hidden in the table', function
->call('toggleReveal', $site->id)
->assertSet('revealedId', null);
});
test('switching a WordPress site to a non-WordPress cms_type clears its credentials', function () {
$site = Site::factory()->wordpress()->create(['wp_username' => 'admin']);
Livewire::test(Index::class)
->call('edit', $site->id)
->set('cmsType', 'custom')
->call('save');
expect($site->fresh())
->cms_type->toBe('custom')
->wp_username->toBeNull()
->wp_app_password->toBeNull();
});