From 56e2d85087591a950a67c1a50fc2c3f2b9794e4f Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 22 Apr 2026 13:46:37 +0200 Subject: [PATCH] Improve test Address Copilot suggestions, add comments. --- tests/PendingTenantsTest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/PendingTenantsTest.php b/tests/PendingTenantsTest.php index 30b2bdd9..5d47428d 100644 --- a/tests/PendingTenantsTest.php +++ b/tests/PendingTenantsTest.php @@ -115,8 +115,14 @@ test('withoutPending chained with where clauses returns correct results', functi $tenant = Tenant::create(); $pendingTenant = Tenant::createPending(); - expect(Tenant::withoutPending()->where('id', $tenant->id)->first()->id)->toBe($tenant->id); - expect(Tenant::withoutPending()->where('id', 'nonexistent-id')->first())->toBeNull(); + $foundTenant = Tenant::withoutPending()->where('id', $tenant->id)->first(); + expect($foundTenant)->not()->toBeNull(); + + // The query returned the correct tenant + expect($foundTenant->id)->toBe($tenant->id); + // No tenant with this ID exists, the query returns null + expect(Tenant::withoutPending()->where('id', Str::random(8) . 'nonexistent-id')->first())->toBeNull(); + // withoutPending() correctly excludes the pending tenant from the query expect(Tenant::withoutPending()->where('id', $pendingTenant->id)->first())->toBeNull(); });