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

Deleting the org mid afterResponse() reseed sent Care→Queue SSO into onboarding; preserve org/owner and reaffirm onboarded instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 19:29:01 +00:00
co-authored by Cursor
parent d91f632544
commit 735a35634f
3 changed files with 58 additions and 2 deletions
+28
View File
@@ -71,6 +71,34 @@ class DemoSeedCommandTest extends TestCase
$this->assertDatabaseHas('queue_organizations', ['id' => $otherOrgId, 'owner_ref' => $other->public_id]);
$this->assertSame('pro', app(PlanService::class)->planKey(Organization::owned($target->public_id)->first()));
$this->assertTrue((bool) data_get(Organization::owned($target->public_id)->first()?->settings, 'onboarded'));
$this->assertSame(
$org->id,
Organization::owned($target->public_id)->value('id'),
'Reset must keep the organization row so login never flashes onboarding',
);
}
public function test_reset_keeps_organization_onboarded_mid_wipe(): void
{
$user = User::create([
'public_id' => 'demo-queue-mid-reset',
'name' => 'Demo Mid',
'email' => 'demo-mid@ladill.com',
'password' => bcrypt('password'),
]);
Artisan::call('demo:seed', ['identity' => $user->email, '--plan' => 'free']);
$orgId = (int) Organization::owned($user->public_id)->value('id');
$this->assertGreaterThan(0, $orgId);
app(\App\Services\Qms\DemoSeeder::class)->resetForOwner($user->public_id);
$org = Organization::query()->find($orgId);
$this->assertNotNull($org);
$this->assertTrue((bool) data_get($org->settings, 'onboarded'));
$this->assertTrue(app(\App\Services\Qms\OrganizationResolver::class)->isOnboarded($user));
$this->assertSame(0, Branch::query()->where('organization_id', $orgId)->whereNull('deleted_at')->count());
}
public function test_idempotent_without_reset(): void