Keep Care org onboarded during demo login reseed.
Deploy Ladill Care / deploy (push) Successful in 1m19s

Avoid the onboarding flash when reset-on-login deletes the tenant before the afterResponse() reseed finishes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 19:29:09 +00:00
co-authored by Cursor
parent a3521247e0
commit 2c2cc1e938
2 changed files with 41 additions and 2 deletions
+25
View File
@@ -188,6 +188,31 @@ class DemoSeedCommandTest extends TestCase
$this->assertSame(1, Branch::query()->where('owner_ref', $keep->public_id)->count());
}
public function test_reset_keeps_organization_onboarded_mid_wipe(): void
{
$user = User::create([
'public_id' => 'demo-mid-reset-id',
'name' => 'Mid Reset Demo',
'email' => 'demo-mid-reset@ladill.com',
]);
$this->artisan('demo:seed', [
'identity' => 'demo-mid-reset@ladill.com',
'--plan' => 'free',
])->assertSuccessful();
$orgId = (int) Organization::query()->where('owner_ref', $user->public_id)->value('id');
$this->assertGreaterThan(0, $orgId);
app(DemoTenantSeeder::class)->resetTenant($user->public_id);
$org = Organization::query()->find($orgId);
$this->assertNotNull($org);
$this->assertTrue((bool) data_get($org->settings, 'onboarded'));
$this->assertTrue(app(\App\Services\Care\OrganizationResolver::class)->isOnboarded($user));
$this->assertSame(0, Branch::query()->where('owner_ref', $user->public_id)->count());
}
public function test_creates_local_mirror_when_public_id_and_email_provided(): void
{
$this->assertDatabaseMissing('users', ['email' => 'new-demo@ladill.com']);