chore: code style

This commit is contained in:
hackerESQ
2025-01-28 17:14:49 -06:00
parent c4736fae70
commit e8ef0921ad
123 changed files with 1051 additions and 1197 deletions
+10 -10
View File
@@ -2,18 +2,19 @@
namespace Tests\Api;
use Tests\TestCase;
use App\Models\User;
use App\Models\Holding;
use App\Models\Portfolio;
use App\Models\Transaction;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class HoldingsTest extends TestCase
{
use RefreshDatabase;
protected User $user;
protected Portfolio $portfolio;
protected function setUp(): void
@@ -29,14 +30,14 @@ class HoldingsTest extends TestCase
$this->actingAs($this->user);
Transaction::factory(10)->create();
$this->actingAs($this->user)
->getJson(route('api.holding.index', ['page' => 1, 'itemsPerPage' => 5]))
->assertOk()
->assertJsonStructure([
'data' => [['id', 'symbol', 'portfolio_id', 'total_market_value', 'dividends_earned']],
'meta' => ['current_page', 'last_page', 'total'],
'links' => ['first', 'last', 'prev', 'next']
'links' => ['first', 'last', 'prev', 'next'],
]);
}
@@ -45,7 +46,7 @@ class HoldingsTest extends TestCase
// create transactions with existing user
$this->actingAs($this->user);
Transaction::factory(10)->create();
// Create a new user
$this->actingAs($user = User::factory()->create());
Transaction::factory(1)->create();
@@ -88,14 +89,14 @@ class HoldingsTest extends TestCase
$transaction = Transaction::factory()->create();
$data = [
'reinvest_dividends' => true
'reinvest_dividends' => true,
];
$this->actingAs($this->user)
->putJson(route('api.holding.update', ['portfolio' => $transaction->portfolio_id, 'symbol' => $transaction->symbol]), $data)
->assertOk()
->assertJsonFragment([
'reinvest_dividends' => true
'reinvest_dividends' => true,
]);
}
@@ -105,7 +106,7 @@ class HoldingsTest extends TestCase
$transaction = Transaction::factory()->create();
$data = [
'reinvest_dividends' => true
'reinvest_dividends' => true,
];
$otherUser = User::factory()->create();
@@ -113,5 +114,4 @@ class HoldingsTest extends TestCase
->putJson(route('api.holding.update', ['portfolio' => $transaction->portfolio_id, 'symbol' => $transaction->symbol]), $data)
->assertForbidden();
}
}
}