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-offer-paths.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:334', $recovered['context_opportunity']); $this->assertSame('Manica', $recovered['selection_labels']['province_id']); $store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $book = $store['offerPreparations']['opportunity:334']; $this->assertCount(2, $book['rows']); $this->assertSame(['P084', 'P085'], array_column($book['rows'], 'branch')); $this->assertSame(['import', 'acquisition'], array_column($book['rows'], 'operation')); $this->assertArrayNotHasKey('result', $book); $this->assertCount(3, $book['history']); $this->assertSame('SYNTHETIC QA finalidade editada deliberadamente', $book['saved']['rows'][0]['purpose']); $this->assertSame('SYNTHETIC QA cheias', $book['rows'][1]['disaster']); $frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g6e-inputs.json')), true, flags: JSON_THROW_ON_ERROR); $prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $this->assertSame($prior['salesOperations'], $store['salesOperations']); $this->assertSame($prior['books'], $store['books']); $this->assertSame($prior['importExemptions']['opportunity:330'], $store['importExemptions']['opportunity:330']); $this->assertSame($prior['importExemptions']['opportunity:331'], $store['importExemptions']['opportunity:331']); $this->assertSame($prior['importExemptions']['opportunity:332'], $store['importExemptions']['opportunity:332']); $this->assertSame($prior['importExemptions'], $store['importExemptions']); $this->assertSame('presented', $book['rows'][0]['request']['state']); $this->assertSame('granted', $book['rows'][0]['requestRecords'][0]['request']['state']); $this->assertSame('SYNTHETIC QA apenas bens A', $book['rows'][0]['requestRecords'][0]['request']['goods']); $this->assertSame('2026-11', $book['rows'][0]['requestRecords'][0]['request']['periodTo']); $this->assertSame('SYNTHETIC QA assistência imediata às vítimas das cheias', $book['rows'][1]['humanitarianPurpose']); $this->assertSame('800', $book['rows'][0]['normalVat']); $this->assertSame('yes', $book['rows'][1]['conditionalAssumption']); $this->assertArrayNotHasKey('appliedBenefit', $book); $this->assertNull($store['books']['opportunity:329']['result']['periods'][0]['fields']['11']); $this->assertNull($store['books']['opportunity:329']['result']['periods'][0]['fields']['17']); $this->assertStringContainsString('BR89', $store['books']['opportunity:329']['result']['sources']); file_put_contents(base_path('outputs/iva-offer-paths-20261024/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)); } }