diff --git a/packages/snaps-jest/src/helpers.test.tsx b/packages/snaps-jest/src/helpers.test.tsx index 1e3322bf2b..87b9400715 100644 --- a/packages/snaps-jest/src/helpers.test.tsx +++ b/packages/snaps-jest/src/helpers.test.tsx @@ -2,15 +2,15 @@ import { NodeProcessExecutionService } from '@metamask/snaps-controllers/node'; import { DialogType } from '@metamask/snaps-sdk'; import { Text } from '@metamask/snaps-sdk/jsx'; import type { InstallSnapOptions } from '@metamask/snaps-simulation'; -import { installSnap as simulateSnap } from '@metamask/snaps-simulation'; -import { getSnapManifest } from '@metamask/snaps-utils/test-utils'; - import { assertIsAlertDialog, assertIsConfirmationDialog, assertIsPromptDialog, - installSnap, -} from './helpers'; + installSnap as simulateSnap, +} from '@metamask/snaps-simulation'; +import { getSnapManifest } from '@metamask/snaps-utils/test-utils'; + +import { installSnap } from './helpers'; import { getMockServer } from './test-utils'; describe('installSnap', () => { diff --git a/packages/snaps-jest/src/helpers.ts b/packages/snaps-jest/src/helpers.ts index 49ffafbca0..dbfbeb247b 100644 --- a/packages/snaps-jest/src/helpers.ts +++ b/packages/snaps-jest/src/helpers.ts @@ -1,6 +1,5 @@ import type { AbstractExecutionService } from '@metamask/snaps-controllers'; import type { SnapId } from '@metamask/snaps-sdk'; -import { DialogType } from '@metamask/snaps-sdk'; import type { InstallSnapOptions } from '@metamask/snaps-simulation'; import { JsonRpcMockOptionsStruct, @@ -13,12 +12,7 @@ import { } from '@metamask/snaps-simulation'; import { HandlerType, logInfo } from '@metamask/snaps-utils'; import { create } from '@metamask/superstruct'; -import { - assert, - assertStruct, - createModuleLogger, - hasProperty, -} from '@metamask/utils'; +import { assertStruct, createModuleLogger } from '@metamask/utils'; import { rootLogger, getEnvironment } from './internals'; import type { @@ -28,11 +22,6 @@ import type { Snap, SnapResponse, TransactionOptions, - SnapInterface, - SnapAlertInterface, - SnapInterfaceActions, - SnapConfirmationInterface, - SnapPromptInterface, } from './types'; const log = createModuleLogger(rootLogger, 'helpers'); @@ -70,39 +59,6 @@ function assertIsResponseWithInterface( assertStruct(response, SnapResponseWithInterfaceStruct); } -/** - * Ensure that the actual interface is an alert dialog. - * - * @param ui - The interface to verify. - */ -export function assertIsAlertDialog( - ui: SnapInterface, -): asserts ui is SnapAlertInterface & SnapInterfaceActions { - assert(hasProperty(ui, 'type') && ui.type === DialogType.Alert); -} - -/** - * Ensure that the actual interface is a confirmation dialog. - * - * @param ui - The interface to verify. - */ -export function assertIsConfirmationDialog( - ui: SnapInterface, -): asserts ui is SnapConfirmationInterface & SnapInterfaceActions { - assert(hasProperty(ui, 'type') && ui.type === DialogType.Confirmation); -} - -/** - * Ensure that the actual interface is a Prompt dialog. - * - * @param ui - The interface to verify. - */ -export function assertIsPromptDialog( - ui: SnapInterface, -): asserts ui is SnapPromptInterface & SnapInterfaceActions { - assert(hasProperty(ui, 'type') && ui.type === DialogType.Prompt); -} - /** * Load a snap into the environment. This is the main entry point for testing * snaps: It returns a {@link Snap} object that can be used to interact with the diff --git a/packages/snaps-jest/src/index.ts b/packages/snaps-jest/src/index.ts index 030365797a..f97525de0f 100644 --- a/packages/snaps-jest/src/index.ts +++ b/packages/snaps-jest/src/index.ts @@ -5,3 +5,12 @@ export { default, default as TestEnvironment } from './environment'; export * from './helpers'; export * from './options'; export * from './types'; + +export { + assertCustomDialogHasNoFooter, + assertCustomDialogHasPartialFooter, + assertIsAlertDialog, + assertIsConfirmationDialog, + assertIsCustomDialog, + assertIsPromptDialog, +} from '@metamask/snaps-simulation';