Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 21d7989

Browse files
claude[bot]claude
andauthored
test(vi-mock): inherit the real @object-ui/components surface in 27 vi.mock factories (#8143)
* test(app-shell,plugin-detail,plugin-timeline): sweep @object-ui/components vi.mock factories to the inheriting form Slice 6 of the per-specifier vi.mock worklist. All 27 frozen `@object-ui/components` factories now obtain the real module through `importOriginal` and spread it FIRST, and the specifier joins `COVERED_SPECIFIERS` in `scripts/check-vi-mock-inherit.mjs` in the same change, as the gate's documented widening precondition requires. Inheriting the real barrel made 15 of the 27 files die during COLLECTION on one cause: the barrel reaches `notifications/severity.ts`, which reads four icons from `lucide-react` at module scope, and those files carried their own frozen `lucide-react` factory that never listed them. Repaired in the neighbouring FACTORY, never in product source. Part of #6892 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr * test(app-shell): drop the deep-relative visibility-gate import the doubled barrel forced The two DeclaredActionsBar suites reached `hasDeclaredVisibilityGate` through `../../../../components/src/renderers/action/visibility-gate` because their `@object-ui/components` factory hand-listed its exports and could not supply it. With the barrel inherited, the real re-export arrives on its own, so the deep path and the paragraph justifying it are both stale; the prose is rewritten rather than left describing a doubled barrel that no longer exists. Both suites stay green (50 tests), which is what shows the re-export is the same function the deep import used to fetch. Part of #6892 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 535eb22 commit 21d7989

29 files changed

Lines changed: 201 additions & 63 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
---
3+
4+
Test-only change: the `@object-ui/components` `vi.mock` factories in `app-shell`,
5+
`plugin-detail` and `plugin-timeline` now inherit the real module's export
6+
surface instead of freezing a hand-written list, and the specifier joins the
7+
`check-vi-mock-inherit` gate's covered set. No published behaviour changes.

‎packages/app-shell/src/console/organizations/__tests__/InviteMemberDialog.placement.test.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ vi.mock('@object-ui/auth', async (importActual) => ({
3838

3939
// Passthrough primitives — the Select is rendered as a native <select> so the
4040
// test can drive it without Radix portal machinery.
41-
vi.mock('@object-ui/components', () => ({
41+
vi.mock('@object-ui/components', async (importOriginal) => ({
42+
...(await importOriginal<Record<string, unknown>>()),
4243
Dialog: ({ open, children }: any) => (open ? <div>{children}</div> : null),
4344
DialogContent: (p: any) => <div {...p} />,
4445
DialogDescription: (p: any) => <p {...p} />,
@@ -59,7 +60,8 @@ vi.mock('@object-ui/components', () => ({
5960
SelectTrigger: (p: any) => <>{p.children}</>,
6061
SelectValue: () => null,
6162
}));
62-
vi.mock('lucide-react', () => ({
63+
vi.mock('lucide-react', async (importOriginal) => ({
64+
...(await importOriginal<Record<string, unknown>>()),
6365
Loader2: () => <span />,
6466
Copy: () => <span />,
6567
Check: () => <span />,

‎packages/app-shell/src/console/organizations/__tests__/InviteMemberDialog.roleCap.test.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ vi.mock('@object-ui/auth', async (importActual) => ({
4242
}),
4343
}));
4444

45-
vi.mock('@object-ui/components', () => ({
45+
vi.mock('@object-ui/components', async (importOriginal) => ({
46+
...(await importOriginal<Record<string, unknown>>()),
4647
Dialog: ({ open, children }: any) => (open ? <div>{children}</div> : null),
4748
DialogContent: (p: any) => <div {...p} />,
4849
DialogDescription: (p: any) => <p {...p} />,
@@ -67,7 +68,8 @@ vi.mock('@object-ui/components', () => ({
6768
SelectTrigger: (p: any) => <>{p.children}</>,
6869
SelectValue: () => null,
6970
}));
70-
vi.mock('lucide-react', () => ({
71+
vi.mock('lucide-react', async (importOriginal) => ({
72+
...(await importOriginal<Record<string, unknown>>()),
7173
Loader2: () => <span />,
7274
Copy: () => <span />,
7375
Check: () => <span />,

‎packages/app-shell/src/console/organizations/__tests__/OrganizationsPage.test.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ vi.mock('../CreateWorkspaceDialog', () => ({
4242
}));
4343

4444
// Passthrough UI primitives (spread props → children render).
45-
vi.mock('@object-ui/components', () => ({
45+
vi.mock('@object-ui/components', async (importOriginal) => ({
46+
...(await importOriginal<Record<string, unknown>>()),
4647
Avatar: (p: any) => <div {...p} />,
4748
AvatarImage: (p: any) => <img {...p} />,
4849
AvatarFallback: (p: any) => <div {...p} />,
@@ -52,7 +53,8 @@ vi.mock('@object-ui/components', () => ({
5253
EmptyTitle: (p: any) => <div {...p} />,
5354
EmptyDescription: (p: any) => <div {...p} />,
5455
}));
55-
vi.mock('lucide-react', () => ({
56+
vi.mock('lucide-react', async (importOriginal) => ({
57+
...(await importOriginal<Record<string, unknown>>()),
5658
Plus: () => <span />,
5759
Search: () => <span />,
5860
Loader2: () => <span />,

‎packages/app-shell/src/console/organizations/__tests__/acceptInvitationLink.mount.test.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ vi.mock('../manage/orgContext', () => ({
5757
}));
5858

5959
// Passthrough primitives — these cases assert a string, not the design system.
60-
vi.mock('@object-ui/components', () => ({
60+
vi.mock('@object-ui/components', async (importOriginal) => ({
61+
...(await importOriginal<Record<string, unknown>>()),
6162
Avatar: (p: any) => <div {...p} />,
6263
AvatarFallback: (p: any) => <div {...p} />,
6364
Badge: (p: any) => <span {...p} />,
@@ -90,7 +91,8 @@ vi.mock('@object-ui/components', () => ({
9091
SelectTrigger: (p: any) => <>{p.children}</>,
9192
SelectValue: () => null,
9293
}));
93-
vi.mock('lucide-react', () => ({
94+
vi.mock('lucide-react', async (importOriginal) => ({
95+
...(await importOriginal<Record<string, unknown>>()),
9496
Loader2: () => <span />,
9597
Copy: () => <span />,
9698
Check: () => <span />,

‎packages/app-shell/src/console/organizations/__tests__/members-role-gating-4475.test.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ vi.mock('react-router-dom', () => ({
114114
useNavigate: () => vi.fn(),
115115
}));
116116

117-
vi.mock('@object-ui/components', () => {
117+
vi.mock('@object-ui/components', async (importOriginal) => {
118+
const actual = await importOriginal<Record<string, unknown>>();
118119
const passthrough = (tag: string) => (p: any) => React.createElement(tag, p, p.children);
119120
return {
121+
...actual,
120122
Avatar: passthrough('div'),
121123
AvatarFallback: passthrough('div'),
122124
AvatarImage: (p: any) => <img {...p} />,
@@ -163,9 +165,11 @@ vi.mock('@object-ui/components', () => {
163165
};
164166
});
165167

166-
vi.mock('lucide-react', () => {
168+
vi.mock('lucide-react', async (importOriginal) => {
169+
const actual = await importOriginal<Record<string, unknown>>();
167170
const icon = () => <span />;
168171
return {
172+
...actual,
169173
Loader2: icon,
170174
Copy: icon,
171175
Check: icon,

‎packages/app-shell/src/console/organizations/__tests__/org-i18n-holdouts-4474.test.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ vi.mock('react-router-dom', () => ({
102102
useParams: () => ({ invitationId: 'inv-1' }),
103103
}));
104104

105-
vi.mock('@object-ui/components', () => {
105+
vi.mock('@object-ui/components', async (importOriginal) => {
106+
const actual = await importOriginal<Record<string, unknown>>();
106107
const passthrough = (tag: string) => (p: any) => React.createElement(tag, p, p.children);
107108
return {
109+
...actual,
108110
Dialog: ({ open, children }: any) => (open ? <div>{children}</div> : null),
109111
DialogContent: passthrough('div'),
110112
DialogDescription: passthrough('p'),
@@ -152,9 +154,11 @@ vi.mock('@object-ui/components', () => {
152154
// object's own keys, and a Proxy has none — every icon reads as undefined. The
153155
// stub is spelled inside the factory because `vi.mock` is hoisted above every
154156
// top-level binding in this file.
155-
vi.mock('lucide-react', () => {
157+
vi.mock('lucide-react', async (importOriginal) => {
158+
const actual = await importOriginal<Record<string, unknown>>();
156159
const icon = () => <span />;
157160
return {
161+
...actual,
158162
Loader2: icon,
159163
Copy: icon,
160164
Check: icon,

‎packages/app-shell/src/hooks/__tests__/sharedInboxFeed.twoSurfaces.test.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({
9292
}),
9393
}));
9494

95-
vi.mock('@object-ui/components', () => {
95+
vi.mock('@object-ui/components', async (importOriginal) => {
96+
const actual = await importOriginal<Record<string, unknown>>();
9697
const stripProps = (p: any) => {
9798
const { asChild, variant, size, align, sideOffset, ...rest } = p ?? {};
9899
return rest;
99100
};
100101
const Pass = ({ children, ...p }: any) => <div {...stripProps(p)}>{children}</div>;
101102
return {
103+
...actual,
102104
Button: ({ children, asChild, variant, size, ...p }: any) => (
103105
<button type="button" {...p}>{children}</button>
104106
),

‎packages/app-shell/src/layout/__tests__/ActivityFeed.unknownKindFailsOpen-6816.test.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({
4242
// is surfaced as `data-variant` rather than dropped: it is the only rendered
4343
// consequence of the SECOND preferences read (the toggle badge's own state),
4444
// so keeping it is what lets a test observe that read at all.
45-
vi.mock('@object-ui/components', () => ({
45+
vi.mock('@object-ui/components', async (importOriginal) => ({
46+
...(await importOriginal<Record<string, unknown>>()),
4647
Button: ({ children, variant, size: _size, ...p }: Record<string, any>) => (
4748
<button type="button" data-variant={variant} {...p}>{children}</button>
4849
),
@@ -59,11 +60,13 @@ vi.mock('@object-ui/components', () => ({
5960
// Named test ids so a row's icon identifies WHICH presentation it rendered
6061
// through — "it did not throw" is a weaker claim than "it took the generic
6162
// bucket".
62-
vi.mock('lucide-react', () => {
63+
vi.mock('lucide-react', async (importOriginal) => {
64+
const actual = await importOriginal<Record<string, unknown>>();
6365
const icon = (name: string) => (props: Record<string, unknown>) => (
6466
<span data-testid={`icon-${name}`} {...props} />
6567
);
6668
return {
69+
...actual,
6770
Activity: icon('Activity'),
6871
Plus: icon('Plus'),
6972
Pencil: icon('Pencil'),

‎packages/app-shell/src/layout/__tests__/AppHeader.inboxVariant.test.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({
5858
// Passthrough primitives: the popover body renders inline instead of driving
5959
// Radix open/close in jsdom (i.e. "as if the user clicked the bell"). Menus
6060
// that Radix would keep unmounted while closed render as nothing.
61-
vi.mock('@object-ui/components', () => {
61+
vi.mock('@object-ui/components', async (importOriginal) => {
62+
const actual = await importOriginal<Record<string, unknown>>();
6263
const Pass = ({ children, ...p }: any) => <div {...stripProps(p)}>{children}</div>;
6364
const stripProps = (p: any) => {
6465
const { asChild, variant, size, align, sideOffset, ...rest } = p ?? {};
6566
return rest;
6667
};
6768
return {
69+
...actual,
6870
Button: ({ children, asChild, variant, size, ...p }: any) => (
6971
<button type="button" {...p}>{children}</button>
7072
),

0 commit comments

Comments
 (0)