feat: L'Ami Fiduciaire V1.0.0 — full codebase with Story 0.1 complete
Initial commit of the L'Ami Fiduciaire SaaS platform built on Laravel 12, Vue 3, Inertia.js 2, and Tailwind CSS 4. Story 0.1 (rename folders to declarations in database) is implemented and code-reviewed: migration, rollback, and 6 Pest tests all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
tests/Feature/Client/ClientEmailTest.php
Normal file
34
tests/Feature/Client/ClientEmailTest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
|
||||
test('primary_contact_email returns principal contact email', function () {
|
||||
$client = Client::factory()->create();
|
||||
$principal = $client->contacts->firstWhere('is_principal', true);
|
||||
|
||||
expect($client->primary_contact_email)->toBe($principal->email);
|
||||
});
|
||||
|
||||
test('primary_contact_email falls back to old contact_email column', function () {
|
||||
$client = Client::factory()->create([
|
||||
'contact_email' => 'fallback@test.com',
|
||||
]);
|
||||
|
||||
// Remove all contacts to force fallback
|
||||
$client->contacts()->delete();
|
||||
$client->unsetRelation('primaryContact');
|
||||
|
||||
expect($client->primary_contact_email)->toBe('fallback@test.com');
|
||||
});
|
||||
|
||||
test('primary_contact_email returns null when no contact exists', function () {
|
||||
$client = Client::factory()->create([
|
||||
'contact_email' => null,
|
||||
]);
|
||||
|
||||
$client->contacts()->delete();
|
||||
$client->unsetRelation('primaryContact');
|
||||
|
||||
expect($client->primary_contact_email)->toBeNull();
|
||||
});
|
||||
Reference in New Issue
Block a user