From 2bf143575000326fc7e169aa8abca5c35dfeaafa Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 26 Oct 2022 14:03:49 +1100 Subject: [PATCH] Fixes for Yodlee tests --- tests/Feature/Bank/BankTransactionTest.php | 11 ++++++----- tests/Feature/Bank/YodleeApiTest.php | 10 ++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/Feature/Bank/BankTransactionTest.php b/tests/Feature/Bank/BankTransactionTest.php index 3cc966d35724..6e78a5c45581 100644 --- a/tests/Feature/Bank/BankTransactionTest.php +++ b/tests/Feature/Bank/BankTransactionTest.php @@ -37,7 +37,9 @@ class BankTransactionTest extends TestCase public function testMatchBankTransactionsValidationShouldFail() { - $data = [ + $data = []; + + $data['transactions'][] = [ 'bad_key' => 10, ]; @@ -52,13 +54,12 @@ class BankTransactionTest extends TestCase public function testMatchBankTransactionValidationShouldPass() { - $data = [ + $data = []; + + $data['transactions'][] = [ 'id' => $this->bank_transaction->hashed_id, ]; -nlog($this->bank_transaction->hashed_id); - - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, diff --git a/tests/Feature/Bank/YodleeApiTest.php b/tests/Feature/Bank/YodleeApiTest.php index 930e15fec7cb..a21349b6ad27 100644 --- a/tests/Feature/Bank/YodleeApiTest.php +++ b/tests/Feature/Bank/YodleeApiTest.php @@ -58,16 +58,18 @@ class YodleeApiTest extends TestCase $bt->date = now()->format('Y-m-d'); $bt->transaction_id = 1234567890; $bt->category_id = 10000003; + $bt->base_type = 'DEBIT'; $bt->save(); - - $data = [ + $data = []; + + $data['transactions'][] = [ 'id' => $bt->id, ]; MatchBankTransactions::dispatchSync($this->company->id, $this->company->db, $data); - $expense = Expense::where('public_notes', 'Fuel')->first(); + $expense = Expense::where('transaction_reference', 'Fuel')->first(); $this->assertNotNull($expense); $this->assertEquals(10, (int)$expense->amount); @@ -116,7 +118,7 @@ class YodleeApiTest extends TestCase $bt->transaction_id = 123456; $bt->save(); - $data = [ + $data['transactions'][] = [ 'id' => $bt->id, 'invoice_ids' => $invoice->hashed_id ];