UNPKG

@stripe/ui-extension-sdk

Version:

The suite of functionality available to UI extensions in Stripe apps

21 lines (20 loc) 1.04 kB
/** * Forking the remote-ui Jest matchers so that: * a. We can rename the matching methods to remove "remote" * b. We can remove all mention of "@shopify/react-testing" in error messages * c. We retain control over the matchers in case we later decide to migrate away from remote-ui */ import type { RemoteComponentType, PropsForRemoteComponent } from '@remote-ui/core'; import type { Node } from '@remote-ui/testing'; type PropsFromNode<T> = NonNullable<T> extends Node<infer U> ? U : never; declare global { namespace jest { interface Matchers<R, T = {}> { toHaveProps(props: Partial<PropsFromNode<T>>): void; toContainComponent<Type extends RemoteComponentType<string, any, any>>(type: Type, props?: Partial<PropsForRemoteComponent<Type>>): void; toContainComponentTimes<Type extends RemoteComponentType<string, any, any>>(type: Type, times: number, props?: Partial<PropsForRemoteComponent<Type>>): void; toContainText(text: string): void; } } } export {};