fix: complete InvesteMoz validation and error corrections

This commit is contained in:
2026-10-29 21:47:33 +02:00
parent 63147312e2
commit daf8623441
718 changed files with 127308 additions and 20959 deletions
+12 -7
View File
@@ -1,4 +1,5 @@
<?php
namespace Tests\Feature;
use App\Models\User;
@@ -27,19 +28,24 @@ final class IvaForeignOperationDraftTest extends TestCase
$store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
$book = $store['foreignOperations']['opportunity:358'];
$this->assertCount(7, $book['rows']);
$this->assertSame(['potential','potential','potential','potential','indeterminate','not_demonstrated','excluded_19_2'],array_column($book['result']['rows'],'relation19'));
$this->assertSame('outside_portion',$book['result']['rows'][3]['territory']);
$this->assertSame('2026-12-10',$book['result']['rows'][0]['event']['eventDate']);
$this->assertSame(['potential', 'potential', 'potential', 'potential', 'indeterminate', 'not_demonstrated', 'excluded_19_2'], array_column($book['result']['rows'], 'relation19'));
$this->assertSame('outside_portion', $book['result']['rows'][3]['territory']);
$this->assertSame('2026-12-10', $book['result']['rows'][0]['event']['eventDate']);
foreach ($book['result']['rows'] as $row) {
$this->assertNull($row['deduction']);$this->assertNull($row['baseAmount']);$this->assertNull($row['vat']);$this->assertNull($row['rate']);
$this->assertNull($row['deduction']);
$this->assertNull($row['baseAmount']);
$this->assertNull($row['vat']);
$this->assertNull($row['rate']);
}
$this->assertSame($book['rows'], $book['result']['inputs']);
$this->assertCount(1, $book['history']);
$this->assertSame('potential',$book['history'][0]['rows'][0]['relation19']);
$this->assertSame('potential', $book['history'][0]['rows'][0]['relation19']);
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-foreign-operations-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
$preserved = array_diff_key($store, ['foreignOperations' => true]);
foreach (['goodsLocations','serviceLocations','listedServices','currencyEvents'] as $map) unset($preserved[$map]['opportunity:358']);
foreach (['goodsLocations', 'serviceLocations', 'listedServices', 'currencyEvents'] as $map) {
unset($preserved[$map]['opportunity:358']);
}
$this->assertSame($prior, $preserved);
$this->assertSame('1250.30', $store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['baseAmount']);
$this->assertNull($store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['vat']);
@@ -48,4 +54,3 @@ final class IvaForeignOperationDraftTest extends TestCase
file_put_contents(base_path('outputs/iva-l1-foreign-operations-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
}
}