first commit
This commit is contained in:
52
tests/Unit/MedicationExpenseServiceTest.php
Normal file
52
tests/Unit/MedicationExpenseServiceTest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Reports\MedicationExpenseService;
|
||||
|
||||
test('medication expense service calculates totals and totals without budget', function () {
|
||||
$service = new MedicationExpenseService();
|
||||
|
||||
$totals = $service->calculateFromMatrix([
|
||||
'oms' => [
|
||||
'alcohol' => 100,
|
||||
'narcotic' => 50,
|
||||
'solutions' => 25,
|
||||
'medicines' => 225,
|
||||
'dressing' => 40,
|
||||
],
|
||||
'budget' => [
|
||||
'alcohol' => 10,
|
||||
'narcotic' => 5,
|
||||
'solutions' => 0,
|
||||
'medicines' => 35,
|
||||
'dressing' => 15,
|
||||
],
|
||||
'paid' => [
|
||||
'alcohol' => 20,
|
||||
'narcotic' => 0,
|
||||
'solutions' => 30,
|
||||
'medicines' => 50,
|
||||
'dressing' => 5,
|
||||
],
|
||||
'vmp_oms' => [
|
||||
'alcohol' => 0,
|
||||
'narcotic' => 10,
|
||||
'solutions' => 10,
|
||||
'medicines' => 30,
|
||||
'dressing' => 20,
|
||||
],
|
||||
'vmp_budget' => [
|
||||
'alcohol' => 5,
|
||||
'narcotic' => 5,
|
||||
'solutions' => 5,
|
||||
'medicines' => 5,
|
||||
'dressing' => 10,
|
||||
],
|
||||
]);
|
||||
|
||||
expect($totals['total_without_dressing'])->toBe(620.0)
|
||||
->and($totals['total_dressing'])->toBe(90.0)
|
||||
->and($totals['total_expense'])->toBe(710.0)
|
||||
->and($totals['without_budget_no_dressing'])->toBe(570.0)
|
||||
->and($totals['without_budget_dressing'])->toBe(75.0)
|
||||
->and($totals['without_budget_total'])->toBe(645.0);
|
||||
});
|
||||
Reference in New Issue
Block a user