Files
jeremy bayseandClaude Sonnet 5 d8dc57a5df Initial commit: SuiviCPT personal finance tracker
Laravel 11 + Livewire 3/Volt + Alpine.js + Tailwind app for household
budget planning, transaction tracking, and financial dashboards.

- Multi-tenant households with member invites
- Plan: monthly/yearly budget per category with overrides
- Suivi: transaction log with running balance (desktop + mobile quick-entry)
- Dashboard: budget vs tracked breakdown + Chart.js donuts
- Flux: Sankey diagram of income allocation
- WCAG 2.1 AA color tokens, dark mode, accessible tables/forms
- 50 Pest tests

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-25 22:39:42 +02:00

51 lines
1.3 KiB
PHP

<?php
use App\Livewire\Categories\Index;
use App\Models\Category;
use App\Models\User;
use Livewire\Livewire;
it('lets a member add a category to their household', function (): void {
$user = User::factory()->create();
Livewire::actingAs($user)
->test(Index::class)
->set('newName.depense', 'Loyer')
->call('add', 'depense')
->assertHasNoErrors();
expect($user->currentHousehold->categories()->where('name', 'Loyer')->exists())->toBeTrue();
});
it('prevents a user from editing another household categorie', function (): void {
$owner = User::factory()->create();
$intruder = User::factory()->create();
$category = $owner->currentHousehold->categories()->create([
'name' => 'Courses',
'type' => 'depense',
'position' => 1,
]);
Livewire::actingAs($intruder)
->test(Index::class)
->call('startEdit', $category->id)
->assertForbidden();
});
it('deletes a category', function (): void {
$user = User::factory()->create();
$category = $user->currentHousehold->categories()->create([
'name' => 'Assurances',
'type' => 'depense',
'position' => 1,
]);
Livewire::actingAs($user)
->test(Index::class)
->call('delete', $category->id);
expect(Category::find($category->id))->toBeNull();
});