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('tests/frontend/fixtures/iva-baggage.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']); $this->assertSame('opportunity:366', $recovered['context_opportunity']); $s = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $b = $s['returneeImports']['opportunity:366']; $this->assertCount(11, $b['rows']); $this->assertCount(1, $b['history']); $this->assertSame($b['rows'], $b['result']['inputs']); foreach ($b['result']['rows'] as $row) { $this->assertSame('exempt', $row['status']); $this->assertSame('0.00', $row['importVat']); $this->assertNull($row['deduction']); $this->assertStringContainsString('57(2)c/d', $row['source']); } $frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-baggage-preserved.json')), true, flags: JSON_THROW_ON_ERROR); $prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $this->assertSame(array_diff_key($prior, ['returneeImports' => true]), array_diff_key($s, ['returneeImports' => true])); foreach ($prior['returneeImports'] as $key => $value) { $this->assertSame($value, $s['returneeImports'][$key]); } $path = base_path('outputs/iva-l1-residuals-baggage-20261025'); if (! is_dir($path)) { mkdir($path, 0775, true); }file_put_contents($path.'/recovered.json', json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)); } }