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:
51
tests/Feature/Database/RenameFoldersToDeclarationsTest.php
Normal file
51
tests/Feature/Database/RenameFoldersToDeclarationsTest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
test('declarations table exists after migration', function () {
|
||||
expect(Schema::hasTable('declarations'))->toBeTrue();
|
||||
expect(Schema::hasTable('folders'))->toBeFalse();
|
||||
});
|
||||
|
||||
test('declaration_invitations table exists after migration', function () {
|
||||
expect(Schema::hasTable('declaration_invitations'))->toBeTrue();
|
||||
expect(Schema::hasTable('folder_invitations'))->toBeFalse();
|
||||
});
|
||||
|
||||
test('messages table has declaration_id column instead of folder_id', function () {
|
||||
expect(Schema::hasColumn('messages', 'declaration_id'))->toBeTrue();
|
||||
expect(Schema::hasColumn('messages', 'folder_id'))->toBeFalse();
|
||||
});
|
||||
|
||||
test('declaration_invitations table has declaration_id column instead of folder_id', function () {
|
||||
expect(Schema::hasColumn('declaration_invitations', 'declaration_id'))->toBeTrue();
|
||||
expect(Schema::hasColumn('declaration_invitations', 'folder_id'))->toBeFalse();
|
||||
});
|
||||
|
||||
test('composite index exists on messages declaration_id and created_at', function () {
|
||||
$indexes = collect(DB::select("PRAGMA index_list('messages')"));
|
||||
$indexColumns = $indexes->flatMap(function ($index) {
|
||||
return collect(DB::select("PRAGMA index_info('{$index->name}')"))
|
||||
->pluck('name')
|
||||
->all();
|
||||
});
|
||||
|
||||
expect($indexColumns->contains('declaration_id'))->toBeTrue();
|
||||
expect($indexColumns->contains('created_at'))->toBeTrue();
|
||||
});
|
||||
|
||||
test('migration is reversible and rollback restores folder tables', function () {
|
||||
// Rollback the rename migration (last one applied)
|
||||
$this->artisan('migrate:rollback', ['--step' => 1]);
|
||||
|
||||
expect(Schema::hasTable('folders'))->toBeTrue();
|
||||
expect(Schema::hasTable('declarations'))->toBeFalse();
|
||||
expect(Schema::hasTable('folder_invitations'))->toBeTrue();
|
||||
expect(Schema::hasTable('declaration_invitations'))->toBeFalse();
|
||||
expect(Schema::hasColumn('messages', 'folder_id'))->toBeTrue();
|
||||
expect(Schema::hasColumn('messages', 'declaration_id'))->toBeFalse();
|
||||
|
||||
// Re-apply to leave DB in correct state for other tests
|
||||
$this->artisan('migrate');
|
||||
});
|
||||
Reference in New Issue
Block a user