add tests
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
test('guests are redirected to the login page', function () {
|
||||
$response = $this->get(route('dashboard'));
|
||||
@@ -14,3 +17,37 @@ test('authenticated users can visit the dashboard', function () {
|
||||
$response = $this->get(route('dashboard'));
|
||||
$response->assertStatus(200);
|
||||
});
|
||||
|
||||
test('dashboard displays aggregated transaction insights', function () {
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
$acme = Company::factory()->create(['legal_name' => 'Acme Investigations AG']);
|
||||
$globex = Company::factory()->create(['legal_name' => 'Globex Surveillance GmbH']);
|
||||
|
||||
Transaction::factory()->for($acme)->requiresReview()->status(Transaction::STATUS_TRUE_POSITIVE)->create([
|
||||
'amount' => 123456.78,
|
||||
'risk_score' => 92,
|
||||
'executed_at' => Carbon::now(),
|
||||
]);
|
||||
|
||||
Transaction::factory()->for($acme)->requiresReview(false)->status(Transaction::STATUS_CLEARED)->create([
|
||||
'amount' => 6543.21,
|
||||
'risk_score' => 30,
|
||||
'executed_at' => Carbon::now()->subDay(),
|
||||
]);
|
||||
|
||||
Transaction::factory()->for($globex)->requiresReview()->status(Transaction::STATUS_FALSE_POSITIVE)->create([
|
||||
'amount' => 25000.00,
|
||||
'risk_score' => 70,
|
||||
'executed_at' => Carbon::now()->subHours(2),
|
||||
]);
|
||||
|
||||
$response = $this->get(route('dashboard'));
|
||||
|
||||
$response->assertOk()
|
||||
->assertSee('Acme Investigations AG')
|
||||
->assertSee('Globex Surveillance GmbH')
|
||||
->assertSee('154.999,99 €')
|
||||
->assertSee('123.456,78 €')
|
||||
->assertSee('Ø Risikoscore 92');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user