Fixes for tests

This commit is contained in:
David Bomba 2023-04-06 12:36:47 +10:00
parent 335ad0c59f
commit 9ee545160c

View File

@ -11,6 +11,8 @@
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\BankIntegration;
use App\Models\BankTransaction;
use Tests\TestCase; use Tests\TestCase;
use App\Models\Expense; use App\Models\Expense;
use Tests\MockAccountData; use Tests\MockAccountData;
@ -44,10 +46,22 @@ class ExpenseApiTest extends TestCase
public function testTransactionIdClearedOnDelete() public function testTransactionIdClearedOnDelete()
{ {
$bi = BankIntegration::factory()->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id,
'account_id' => $this->account->id
]);
$bt = BankTransaction::factory()->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id,
'bank_integration_id' => $bi->id,
]);
$e = Expense::factory()->create([ $e = Expense::factory()->create([
'company_id' => $this->company->id, 'company_id' => $this->company->id,
'user_id' => $this->user->id, 'user_id' => $this->user->id,
'transaction_id' => '123', 'transaction_id' => $bt->id,
]); ]);
$this->assertNotNull($e->transaction_id); $this->assertNotNull($e->transaction_id);