chore: code style
This commit is contained in:
@@ -2,19 +2,16 @@
|
||||
|
||||
namespace Tests;
|
||||
|
||||
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;
|
||||
|
||||
class TransactionsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
*/
|
||||
public function test_can_create_a_transaction(): void
|
||||
{
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
@@ -24,8 +21,6 @@ class TransactionsTest extends TestCase
|
||||
$this->assertNotNull($transaction);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function test_sales_calculate_cost_basis(): void
|
||||
{
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
@@ -37,8 +32,6 @@ class TransactionsTest extends TestCase
|
||||
$this->assertNotNull($transaction->cost_basis);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function test_purchases_dont_have_sale_price(): void
|
||||
{
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
@@ -48,8 +41,6 @@ class TransactionsTest extends TestCase
|
||||
$this->assertNull($transaction->sale_price);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function test_transaction_synced_to_holding(): void
|
||||
{
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
@@ -62,17 +53,17 @@ class TransactionsTest extends TestCase
|
||||
$this->assertDatabaseHas('holdings', [
|
||||
'portfolio_id' => $portfolio->id,
|
||||
'symbol' => 'AAPL',
|
||||
'quantity' => 4
|
||||
'quantity' => 4,
|
||||
]);
|
||||
|
||||
$holding = Holding::where([
|
||||
'portfolio_id' => $portfolio->id,
|
||||
'symbol' => 'AAPL'
|
||||
'symbol' => 'AAPL',
|
||||
])->first();
|
||||
|
||||
$this->assertEqualsWithDelta(
|
||||
$holding->realized_gain_dollars,
|
||||
$transaction->sale_price - $transaction->cost_basis,
|
||||
$holding->realized_gain_dollars,
|
||||
$transaction->sale_price - $transaction->cost_basis,
|
||||
0.01
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user