fixes login page in tenant admin pwa
This commit is contained in:
@@ -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'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user