Delete holding if no related transactions

resolves #63
This commit is contained in:
hackerESQ
2025-08-25 20:23:59 -05:00
parent 0504058c01
commit 97298bcd39
3 changed files with 27 additions and 2 deletions
+4 -2
View File
@@ -78,18 +78,20 @@ class ImportExportTest extends TestCase
{
$this->actingAs($user = User::factory()->create());
Portfolio::create([
$portfolio = Portfolio::create([
'id' => '9e792bb8-94e7-4ed3-b8cc-43b50d34c337',
'title' => 'Test Portfolio',
]);
$holding = Holding::create([
'portfolio_id' => '9e792bb8-94e7-4ed3-b8cc-43b50d34c337',
'portfolio_id' => $portfolio->id,
'symbol' => 'ACME',
'quantity' => 0,
'reinvest_dividends' => false,
]);
Transaction::factory()->buy()->lastYear()->costBasis(100)->portfolio($portfolio->id)->symbol('AAPL')->create();
$this->assertEquals(false, $holding->reinvest_dividends);
BackupImportModel::create([