refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s

This commit is contained in:
Kroonk
2026-05-22 16:19:55 +02:00
parent 38cc4c09ca
commit a213a1dba0
2215 changed files with 242567 additions and 6015 deletions

View File

@@ -0,0 +1,70 @@
<?php
namespace Tests\Api\Settings;
use Tests\ApiTestCase;
use App\Models\Settings\Currency;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ApiCurrencyControllerTest extends ApiTestCase
{
use DatabaseTransactions;
protected $jsonStructureCurrency = [
'id',
'object',
'iso',
'name',
'symbol',
];
/** @test */
public function it_gets_all_the_currencies()
{
// in theory the currencies table is seeded by the initial script
$response = $this->json('GET', '/api/currencies/');
$response->assertStatus(200);
$this->assertCount(
15,
$response->decodeResponseJson()['data']
);
$response->assertJsonFragment([
'total' => 153,
'current_page' => 1,
]);
$response->assertJsonStructure([
'data' => ['*' => $this->jsonStructureCurrency],
]);
}
/** @test */
public function it_gets_one_currency()
{
$currency = factory(Currency::class)->create([]);
$response = $this->json('GET', '/api/currencies/'.$currency->id);
$response->assertStatus(200);
$response->assertJsonFragment([
'id' => $currency->id,
'object' => 'currency',
]);
$response->assertJsonStructure([
'data' => $this->jsonStructureCurrency,
]);
}
/** @test */
public function it_gets_a_currency_that_is_invalid()
{
$response = $this->json('GET', '/api/currencies/0');
$this->expectNotFound($response);
}
}