mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-30 14:56:15 +00:00
tsgo 707->0; alias next-themes/next/* to browser stubs (kills blank-page crash); resolve [[.BaseHref]]/[[.Settings]] at build time; Dockerfile.site builds from source; [email protected].4 pin. Render-proven (Playwright, all routes, 0 ReferenceError).
29 lines
833 B
TypeScript
29 lines
833 B
TypeScript
import React from 'react';
|
|
|
|
const IconMock = React.forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>(
|
|
(props, ref) => <svg ref={ref} {...props} />,
|
|
);
|
|
IconMock.displayName = 'IconMock';
|
|
|
|
// Returns a Proxy that resolves any named export to IconMock by default,
|
|
// so `import { AnyIcon } from 'components/ui/icons'` always returns a valid component.
|
|
// Pass `overrides` to swap in test-specific stubs (e.g. icons with data-testid).
|
|
export function createIconsMock(
|
|
overrides: Record<string, unknown> = {},
|
|
): Record<string | symbol, unknown> {
|
|
return new Proxy(
|
|
{ __esModule: true, default: IconMock, ...overrides } as Record<
|
|
string | symbol,
|
|
unknown
|
|
>,
|
|
{
|
|
get(target, prop: string | symbol): unknown {
|
|
if (prop in target) {
|
|
return target[prop as string];
|
|
}
|
|
return IconMock;
|
|
},
|
|
},
|
|
);
|
|
}
|