Preserve selected portfolio context through investment preparation
This commit is contained in:
@@ -130,8 +130,13 @@ final class InvestmentOpportunityChoicesTest extends TestCase
|
||||
$snapshot = $view['prefill']['simulator']['context_applicability_snapshot'];
|
||||
$this->assertCount(34, json_decode($snapshot, true)['opportunity_choices']);
|
||||
$this->assertLessThan(1000000, strlen($snapshot));
|
||||
// Mirror the existing browser partition: labels are persisted under selection_labels.
|
||||
$economic = [...$view['prefill']['simulator'], 'purpose' => 'simulate_only', 'currency' => 'MZN'];
|
||||
foreach (array_keys($economic) as $field) if (str_ends_with($field, '_label')) {
|
||||
$economic['selection_labels'][substr($field, 0, -6)] = $economic[$field]; unset($economic[$field]);
|
||||
}
|
||||
$draft = $this->postJson('/api/v1/simulation-drafts', ['context' => $id, 'personal_snapshot' => [],
|
||||
'economic_snapshot' => [...$view['prefill']['simulator'], 'purpose' => 'simulate_only', 'currency' => 'MZN']], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json();
|
||||
'economic_snapshot' => $economic], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json();
|
||||
$this->assertNotEmpty($draft);
|
||||
$this->getJson('/investimentos/'.$id.'/contexto')->assertOk()->assertJsonPath('context.opportunity_choices.33.opportunity.key', 'opportunity:'.$records[33]->id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user