Skip to content

Commit 5aa24e5

Browse files
alin-vladclaude
andcommitted
test(checkout): U-B143 — update LocalitiesDataTest for the value-only island (magento#3)
U-B138 projected the client island to value-only arrays but left this ViewModel test asserting the old {value,label} shape (it wasn't in the targeted run — the localitate e2e was). Now asserts the value-only projection. Full Otter suite 1047/1047. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8fe5182 commit 5aa24e5

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

app/code/Otter/HyvaCheckout/Test/Unit/ViewModel/LocalitiesDataTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,24 @@
1515
*/
1616
class LocalitiesDataTest extends TestCase
1717
{
18-
public function testGetMapJsonReturnsValidJsonOfTheMap(): void
18+
public function testGetMapJsonReturnsValueOnlyProjectionOfTheMap(): void
1919
{
20-
$map = ['Cluj' => [['value' => 'TURDA', 'label' => 'Turda']]];
20+
// U-B138 — the repo provides the full {value,label} map (its server
21+
// shape), but getMapJson PROJECTS the client island to value-only arrays;
22+
// locality-reset.js derives the label by title-casing the value. This
23+
// ~halves the inline island.
24+
$map = ['Cluj' => [
25+
['value' => 'TURDA', 'label' => 'Turda'],
26+
['value' => 'DEJ', 'label' => 'Dej'],
27+
]];
2128
$repo = $this->createMock(CitysRepository::class);
2229
$repo->method('getAllLocalitiesMap')->willReturn($map);
2330

2431
$vm = new LocalitiesData($repo);
2532
$json = $vm->getMapJson();
2633

2734
$this->assertJson($json);
28-
$this->assertSame($map, json_decode($json, true));
35+
$this->assertSame(['Cluj' => ['TURDA', 'DEJ']], json_decode($json, true));
2936
}
3037

3138
public function testGetMapJsonReturnsEmptyObjectOnFailure(): void

0 commit comments

Comments
 (0)