Skip to content

Commit 51499a9

Browse files
backspaceclaude
andcommitted
Compare class-hierarchy HTML keys as a set, not by order
`Object.keys(embeddedHtml)` / `Object.keys(fittedHtml)` reflect the stored `embedded_html` / `fitted_html` key order, which is lexical after the storage round-trip, not semantically meaningful — consumers look these up by key. With the base CardDef key in RRI prefix form (`@cardstack/base/card-api/CardDef`) it sorts ahead of the test realm's `http://test-realm/...` keys, where the old `https://cardstack.com/...` key sorted after. Compare the key sets order-independently so the assertion tracks the contract (which types are present) rather than a storage-dependent ordering. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a525f27 commit 51499a9

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

packages/host/tests/integration/realm-indexing-test.gts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,13 +2029,17 @@ module(`Integration | realm indexing`, function (hooks) {
20292029
undefined,
20302030
getService('network').virtualNetwork,
20312031
);
2032+
// Compare as a set: the `embedded_html` key order is lexical after
2033+
// storage round-trip, not semantically meaningful, and the base
2034+
// CardDef key sorts differently in RRI prefix form (`@cardstack/...`)
2035+
// than in URL form. Consumers look up by key, never by position.
20322036
assert.deepEqual(
2033-
Object.keys(embeddedHtml!),
2037+
[...Object.keys(embeddedHtml!)].sort(),
20342038
[
20352039
`${testRealmURL}fancy-person/FancyPerson`,
20362040
`${testRealmURL}person/Person`,
20372041
cardDefRefURL,
2038-
],
2042+
].sort(),
20392043
'embedded class hierarchy is correct',
20402044
);
20412045

@@ -2178,13 +2182,15 @@ module(`Integration | realm indexing`, function (hooks) {
21782182
undefined,
21792183
getService('network').virtualNetwork,
21802184
);
2185+
// Compare as a set: see the embedded-hierarchy assertion above —
2186+
// `fitted_html` key order is lexical after storage, not semantic.
21812187
assert.deepEqual(
2182-
Object.keys(fittedHtml!),
2188+
[...Object.keys(fittedHtml!)].sort(),
21832189
[
21842190
`${testRealmURL}fancy-person/FancyPerson`,
21852191
`${testRealmURL}person/Person`,
21862192
cardDefRefURL,
2187-
],
2193+
].sort(),
21882194
'fitted class hierarchy is correct',
21892195
);
21902196

0 commit comments

Comments
 (0)