Fix test cases.

This commit is contained in:
James Cole 2025-01-03 04:51:42 +01:00
parent c17f2efca6
commit ae80fd8578
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 6 additions and 2 deletions

View File

@ -100,7 +100,7 @@ final class CurrencyControllerTest extends TestCase
$this->actingAs($user); $this->actingAs($user);
// create test data // create test data
$this->createTestCurrencies(10, true); $this->createTestCurrencies(9, true);
// test API // test API
$response = $this->get(route('api.v1.autocomplete.currencies'), ['Accept' => 'application/json']); $response = $this->get(route('api.v1.autocomplete.currencies'), ['Accept' => 'application/json']);
@ -134,7 +134,7 @@ final class CurrencyControllerTest extends TestCase
$response = $this->get(route('api.v1.autocomplete.currencies'), ['Accept' => 'application/json']); $response = $this->get(route('api.v1.autocomplete.currencies'), ['Accept' => 'application/json']);
$response->assertStatus(200); $response->assertStatus(200);
$response->assertHeader('Content-Type', 'application/json'); $response->assertHeader('Content-Type', 'application/json');
$response->assertJsonCount(0); $response->assertJsonCount(1); // always connects to EUR.
} }
public function testGivenAuthenticatedRequestWhenCallingTheCurrenciesEndpointWithQueryThenReturnsCurrenciesWithLimit(): void public function testGivenAuthenticatedRequestWhenCallingTheCurrenciesEndpointWithQueryThenReturnsCurrenciesWithLimit(): void

View File

@ -23,8 +23,10 @@ declare(strict_types=1);
namespace Tests\integration; namespace Tests\integration;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\UserGroup; use FireflyIII\Models\UserGroup;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Tests\integration\Traits\CollectsValues; use Tests\integration\Traits\CollectsValues;
@ -35,8 +37,10 @@ abstract class TestCase extends BaseTestCase
{ {
use CollectsValues; use CollectsValues;
use CreatesApplication; use CreatesApplication;
use RefreshDatabase;
protected const MAX_ITERATIONS = 2; protected const MAX_ITERATIONS = 2;
protected $seed = true;
public function dateRangeProvider(): array public function dateRangeProvider(): array
{ {