openpencil/tests/helpers/fig/nested-binding.ts
Danila Poyarkov f7a013191b
refactor(fig): export the symbol readers and move the library tests home (#929)
The Kiwi codec types only symbolID, so every test reading symbolOverrides
or uniformScaleFactor repeated the same cast against a type the package
exported without the readers that go with it. symbolDataOf and
symbolOverridesOf are now exported and five call sites use them.

tests/engine/library exercises @/app/libraries, so it belongs under
tests/app by the placement rules; the shard list and the engine baseline
follow it.
2026-10-06 10:44:22 +00:00

19 lines
800 B
TypeScript

import { symbolOverridesOf } from '@open-pencil/fig/instance-overrides'
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
import fixture from '#tests/fixtures/nested-binding-ownership-records.json' with { type: 'json' }
import { expectDefined } from '#tests/helpers/assert'
/** Remove only the placed owner's declaration, retaining the saved inherited expression. */
export function inheritedNestedBindingRecords(): NodeChange[] {
const changes = structuredClone(fixture.nodeChanges) as NodeChange[]
const owner = expectDefined(
changes.find((node) => node.guid?.sessionID === 293733 && node.guid.localID === 8),
'captured owner'
)
for (const override of symbolOverridesOf(owner)) {
Reflect.deleteProperty(override, 'parameterConsumptionMap')
}
return changes
}