commit1
tests / ci (push) Waiting to run

This commit is contained in:
2026-10-28 12:23:16 +02:00
parent 4d42f083ce
commit eb1c8b8074
20 changed files with 2141 additions and 58 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
use App\Models\User;
use Inertia\Testing\AssertableInertia as Assert;
test('visual consultation is accessible without authentication', function () {
$this->get('/consulta')->assertOk()->assertInertia(fn (Assert $page) => $page
->component('preview/index')
->where('auth.user', null)
->missing('suppliers')->missing('requisitions')->missing('documents'));
$this->assertGuest();
});
test('preview does not expose authenticated account data or log it out', function () {
$user = User::factory()->create();
$this->actingAs($user)->get('/consulta')->assertOk()->assertInertia(fn (Assert $page) => $page->where('auth.user', null));
$this->assertAuthenticatedAs($user);
});
test('consultation creates no business access or mutation endpoint', function () {
$this->get('/consulta')->assertOk();
foreach (['/dashboard', '/fornecedores', '/cotacoes', '/conflitos'] as $path) {
$this->get($path)->assertRedirect('/login');
}
$this->post('/fornecedores', ['name' => 'Tentativa pública'])->assertRedirect('/login');
$this->post('/consulta', [])->assertStatus(405);
expect(User::query()->count())->toBe(0);
});