Skip to content

Commit 3e2d5e3

Browse files
committed
test(core): the role registry test checks every table discovery registered
It filtered the registry to the four shared tables, so the first component table that discovery found would fail it. It now compares every table the discovery loop registered against the generated role kinds (a probe table added under motion/uikit passes once the list is regenerated).
1 parent 2164696 commit 3e2d5e3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎packages/core/src/motion/roles.test.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ for (const file of motionTableFiles(resolve(__dirname, '..'))) {
4040
}
4141
}
4242
}
43+
// The tables that discovery registered, before any test adds a fixture.
44+
const DISCOVERED = new Set(
45+
listMotionRoles().map(role => role.id.split('.')[0]),
46+
);
4347

4448
describe('motion roles', () => {
4549
it('names a role by its table path, and its CSS variable in kebab case', () => {
@@ -113,14 +117,12 @@ describe('motion roles', () => {
113117
});
114118

115119
it('lists every registered role, and its kind, in the generated role kinds', () => {
116-
// The shared tables (other tests here register tables of their own).
117-
const shared = listMotionRoles().filter(role =>
118-
['springs', 'scroll', 'timing', 'navigation'].includes(
119-
role.id.split('.')[0],
120-
),
120+
// Every table discovery registered (other tests here add fixtures).
121+
const discovered = listMotionRoles().filter(role =>
122+
DISCOVERED.has(role.id.split('.')[0]),
121123
);
122124
expect(
123-
Object.fromEntries(shared.map(role => [role.id, role.kind])),
125+
Object.fromEntries(discovered.map(role => [role.id, role.kind])),
124126
).toEqual(MOTION_ROLE_KINDS);
125127
});
126128

0 commit comments

Comments
 (0)