fixes login page in tenant admin pwa

This commit is contained in:
Codex Agent
2025-11-07 13:52:29 +01:00
parent 253239455b
commit f3c44be76d
9 changed files with 156 additions and 21 deletions

View File

@@ -95,4 +95,31 @@ class TenantProfileApiTest extends TestCase
$response->assertStatus(401);
}
public function test_exchange_returns_no_content_when_session_missing(): void
{
$response = $this->postJson('/api/v1/tenant-auth/exchange');
$response->assertNoContent();
}
public function test_exchange_returns_token_for_authenticated_session(): void
{
$tenant = Tenant::factory()->create();
$user = User::factory()->create([
'tenant_id' => $tenant->id,
'role' => 'tenant_admin',
'email_verified_at' => now(),
]);
$response = $this->actingAs($user)->postJson('/api/v1/tenant-auth/exchange');
$response->assertOk();
$response->assertJsonStructure([
'token',
'token_type',
'abilities',
'user' => ['id', 'email', 'role', 'tenant_id'],
]);
}
}