makeTestData(); $this->withoutMiddleware( ThrottleRequests::class ); } public function testMatchBankTransactionsValidationShouldFail() { $data = []; $data['transactions'][] = [ 'bad_key' => 10, ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->postJson('/api/v1/bank_transactions/match', $data); $response->assertStatus(422); } public function testMatchBankTransactionValidationShouldPass() { $data = []; $bi = BankIntegrationFactory::create($this->company->id, $this->user->id, $this->account->id); $bi->save(); $bt = BankTransactionFactory::create($this->company->id, $this->user->id); $bt->bank_integration_id = $bi->id; $bt->description = 'Fuel'; $bt->amount = 10; $bt->currency_code = $this->client->currency()->code; $bt->date = now()->format('Y-m-d'); $bt->transaction_id = 1234567890; $bt->category_id = 10000003; $bt->base_type = 'DEBIT'; $bt->save(); $data = []; $data['transactions'][] = [ 'id' => $bt->hashed_id, ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->postJson('/api/v1/bank_transactions/match', $data); $response->assertStatus(200); } }