1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 19:04:04 +00:00

Improve test

Address Copilot suggestions, add comments.
This commit is contained in:
lukinovec 2026-04-22 13:46:37 +02:00
parent 517861506b
commit 56e2d85087

View file

@ -115,8 +115,14 @@ test('withoutPending chained with where clauses returns correct results', functi
$tenant = Tenant::create(); $tenant = Tenant::create();
$pendingTenant = Tenant::createPending(); $pendingTenant = Tenant::createPending();
expect(Tenant::withoutPending()->where('id', $tenant->id)->first()->id)->toBe($tenant->id); $foundTenant = Tenant::withoutPending()->where('id', $tenant->id)->first();
expect(Tenant::withoutPending()->where('id', 'nonexistent-id')->first())->toBeNull(); 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(); expect(Tenant::withoutPending()->where('id', $pendingTenant->id)->first())->toBeNull();
}); });