assertSame('simulator_fiscal_delta_20261021_test',$target->name);$this->assertSame(55441,(int)$target->port); config(['investor-path.enabled'=>true,'suitecrm.enabled'=>false]);$this->actingAs(User::factory()->create(['email_verified_at'=>now()])); $draft=json_decode(file_get_contents(base_path('outputs/iva-l3-ab-20261025/calculated.json')),true,flags:JSON_THROW_ON_ERROR); $id=$this->postJson('/api/v1/simulation-drafts',['personal_snapshot'=>[],'economic_snapshot'=>$draft],['Idempotency-Key'=>(string)Str::uuid()])->assertCreated()->json('data.id'); $recovered=$this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot'); $this->assertSame($draft['modelo_a_snapshot'],$recovered['modelo_a_snapshot']); $s=json_decode($recovered['modelo_a_snapshot'],true,flags:JSON_THROW_ON_ERROR);$b=$s['ivaClosures']['opportunity:373'];$this->assertCount(3,$b['rows']);$this->assertCount(2,$b['history']); $this->assertSame(['determined','determined','determined'],array_column($b['result']['rows'],'status')); foreach([0=>'150',1=>'70',2=>'0'] as $i=>$v)$this->assertSame(['numerator'=>$v,'denominator'=>'1'],$b['result']['rows'][$i]['fields']['26']); $r=$b['result']['rows'][2];foreach(['19'=>'70','20'=>'20','22'=>'70','23'=>'2','24'=>'72','25'=>'0'] as $field=>$v)$this->assertSame(['numerator'=>$v,'denominator'=>'1'],$r['fields'][(string)$field]); $this->assertSame(['numerator'=>'30','denominator'=>'1'],$r['paid']);$this->assertSame(['numerator'=>'42','denominator'=>'1'],$r['outstanding']); $this->assertSame('2025-12',$b['result']['inputs'][0]['credits'][0]['period']);$this->assertSame('SYNTHETIC QA saldoabertura',$b['result']['inputs'][0]['credits'][0]['reference']); $this->assertSame('2026-03-10',$b['result']['inputs'][2]['credits'][1]['date']); $frozen=json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-l3ab-preserved.json')),true,flags:JSON_THROW_ON_ERROR); foreach(json_decode($frozen['modelo_a_snapshot'],true,flags:JSON_THROW_ON_ERROR) as $key=>$map){if($key==='version')continue;foreach($map as $context=>$original)$this->assertSame($original,$s[$key][$context]);} $this->assertSame('100.00',$s['books']['opportunity:373']['result']['periods'][0]['fields']['18']); $this->assertSame('160.00',$s['books']['opportunity:373']['result']['periods'][2]['fields']['17']); file_put_contents(base_path('outputs/iva-l3-ab-20261025/recovered.json'),json_encode($recovered,JSON_THROW_ON_ERROR|JSON_UNESCAPED_UNICODE)); } }