chore: code style
This commit is contained in:
+10
-10
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user