2025-01-30 11:58:21 -08:00
|
|
|
<?php
|
|
|
|
|
2025-02-01 09:57:57 -08:00
|
|
|
use App\Filament\Admin\Resources\QuoteResource\Pages\CreateQuote;
|
2025-01-30 11:58:21 -08:00
|
|
|
use App\Filament\Admin\Resources\QuoteResource\Pages\ListQuotes;
|
2025-02-01 09:57:57 -08:00
|
|
|
use App\Models\Customer;
|
2025-01-30 11:58:21 -08:00
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
|
|
|
|
use function Pest\Livewire\livewire;
|
|
|
|
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
|
|
|
|
it('can render the list page', function () {
|
|
|
|
$this->actingAs(User::factory(['is_admin' => true])->create());
|
|
|
|
livewire(ListQuotes::class)->assertSuccessful();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('cannot render the list page if user isn\'t an admin', function () {
|
|
|
|
$this->actingAs(User::factory()->create());
|
|
|
|
livewire(ListQuotes::class)->assertForbidden();
|
|
|
|
});
|
2025-02-01 09:57:57 -08:00
|
|
|
|
|
|
|
it('can create a quote using the form', function () {
|
|
|
|
$this->actingAs(User::factory(['is_admin' => true])->create());
|
|
|
|
|
|
|
|
$customer = Customer::factory()->create();
|
|
|
|
|
|
|
|
$formData = [
|
|
|
|
'customer_id' => $customer->id,
|
|
|
|
'date' => today(),
|
|
|
|
'notes' => 'Some note',
|
|
|
|
];
|
|
|
|
|
|
|
|
$this->livewire(CreateQuote::class)
|
|
|
|
->fillForm($formData)
|
|
|
|
->call('create')
|
|
|
|
->assertHasNoErrors();
|
|
|
|
|
|
|
|
$this->assertDatabaseHas('quotes', $formData);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can add an embroidery entry to the quote using the form', function () {});
|
|
|
|
|
|
|
|
it('can add a screen printing entry to the quote using the form', function () {});
|
|
|
|
|
|
|
|
it('can add a heat transfer entry to the quote using the form', function () {});
|