mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-20 19:54:08 +00:00
Merge pull request #616 from mchev/taxdecimal
Support 3-decimal tax percentages (e.g. 6.625%)
This commit is contained in:
@@ -5,6 +5,7 @@ use App\Http\Requests\TaxTypeRequest;
|
||||
use App\Models\TaxType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
use function Pest\Laravel\deleteJson;
|
||||
@@ -110,3 +111,22 @@ test('create fixed amount tax type', function () {
|
||||
|
||||
$this->assertDatabaseHas('tax_types', $taxType);
|
||||
});
|
||||
|
||||
test('create percentage tax type with three decimals', function () {
|
||||
$payload = TaxType::factory()->raw([
|
||||
'calculation_type' => 'percentage',
|
||||
'percent' => 6.625,
|
||||
'fixed_amount' => null,
|
||||
]);
|
||||
|
||||
$response = postJson('api/v1/tax-types', $payload)
|
||||
->assertStatus(201);
|
||||
|
||||
$taxTypeId = $response->json('data.id');
|
||||
|
||||
expect($taxTypeId)->not()->toBeNull();
|
||||
|
||||
$rawPercent = DB::table('tax_types')->where('id', $taxTypeId)->value('percent');
|
||||
|
||||
expect((string) $rawPercent)->toBe('6.625');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user