Wire Frontdesk demo seeder to shared DemoWorld
Deploy Ladill Frontdesk / deploy (push) Successful in 1m10s

Org name, branches, and visitors now come from DemoWorld so continuity
matches Care/Queue across the suite, plus Members for DemoWorld staff
with a frontdesk role. Also resolve organization by owner_ref when
metadata.frontdesk.organization_id is missing, and skip reseed-on-login
for DemoWorld staff emails.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 13:35:52 +00:00
co-authored by Cursor
parent 1c0b5fdce7
commit a28e8619a1
5 changed files with 648 additions and 12 deletions
+37
View File
@@ -5,12 +5,14 @@ namespace Tests\Feature;
use App\Models\Branch;
use App\Models\Device;
use App\Models\Host;
use App\Models\Member;
use App\Models\Organization;
use App\Models\User;
use App\Models\Visit;
use App\Models\Visitor;
use App\Models\WatchlistEntry;
use App\Services\Frontdesk\PlanService;
use App\Support\DemoWorld;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Str;
use Tests\TestCase;
@@ -103,4 +105,39 @@ class DemoSeedCommandTest extends TestCase
$this->assertSame(1, Branch::query()->where('organization_id', $fresh->id)->count());
$this->assertSame(40, Visit::query()->where('organization_id', $fresh->id)->count());
}
public function test_demo_world_continuity_and_staff_roles(): void
{
$user = User::create([
'public_id' => 'demo-world-frontdesk-id',
'name' => 'Ladill Demo (Pro)',
'email' => 'demo-pro@ladill.com',
]);
$this->artisan('demo:seed', [
'identity' => $user->email,
'--plan' => 'pro',
])->assertSuccessful();
$org = Organization::query()->where('owner_ref', $user->public_id)->firstOrFail();
$this->assertSame(DemoWorld::business('pro')['name'], $org->name);
$ama = DemoWorld::personByKey('ama-mensah');
$this->assertNotNull($ama);
$visitor = Visitor::query()
->where('organization_id', $org->id)
->where('phone', $ama['phone'])
->first();
$this->assertNotNull($visitor);
$this->assertSame($ama['email'], $visitor->email);
$this->assertSame(DemoWorld::companyNameForPerson($ama), $visitor->company);
$this->assertTrue(
Member::query()
->where('organization_id', $org->id)
->where('user_ref', 'demo-pro-receptionist@ladill.com')
->where('role', 'receptionist')
->exists()
);
}
}