UNPKG

@metamask/snaps-jest

Version:

A Jest preset for end-to-end testing MetaMask Snaps, including a Jest environment, and a set of Jest matchers

43 lines 1.92 kB
import type { MatcherFunction } from "@jest/expect"; import type { EnumToUnion, ComponentOrElement, NotificationType, TrackableError, TraceRequest } from "@metamask/snaps-sdk"; import type { JSXElement } from "@metamask/snaps-sdk/jsx"; import type { Json } from "@metamask/utils"; /** * Check if a JSON-RPC response matches the expected value. This matcher is * intended to be used with the `expect` global. * * @param actual - The actual response. * @param expected - The expected response. * @returns The status and message. */ export declare const toRespondWith: MatcherFunction<[expected: Json]>; export declare const toRespondWithError: MatcherFunction<[expected: Json]>; /** * Check if the snap sent a notification with the expected message. This matcher * is intended to be used with the `expect` global. * * @param actual - The actual response. * @param expectedMessage - The expected notification message. * @param expectedType - The expected notification type. * @param expectedTitle - The expected notification title. * @param expectedContent - The expected notification JSX content. * @param expectedFooterLink - The expected footer link object. * @returns The status and message. */ export declare const toSendNotification: MatcherFunction<[ expectedMessage: string, expectedType?: EnumToUnion<NotificationType> | undefined, expectedTitle?: string | undefined, expectedContent?: JSXElement | undefined, expectedFooterLink?: { text: string; href: string; } | undefined ]>; export declare const toRender: MatcherFunction<[expected: ComponentOrElement]>; export declare const toTrackError: MatcherFunction<[ errorData?: Partial<TrackableError> ]>; export declare const toTrackEvent: MatcherFunction<[eventData?: Json | undefined]>; export declare const toTrace: MatcherFunction<[traceData?: TraceRequest]>; //# sourceMappingURL=matchers.d.mts.map