Skip to content

extractNavigationTargets

extractNavigationTargets(mock): string[]

Defined in: packages/core/src/extractNavigationTargets.ts:27

Extracts all navigation target screen IDs from a mock definition.

This function collects all navigateTo, itemNavigateTo, and rowNavigateTo values from mock elements to automatically derive the next array. It recursively processes child sections.

ScreenMock

The screen mock definition

string[]

Array of unique screen IDs that can be navigated to

const mock = {
sections: [{
elements: [
{ type: "button", label: "Edit", navigateTo: "billing.invoice.edit" },
{ type: "list", label: "Items", itemNavigateTo: "billing.item.detail" },
]
}]
}
extractNavigationTargets(mock)
// => ["billing.invoice.edit", "billing.item.detail"]