diff --git a/app/components/Views/confirmations/hooks/useSignatureMetrics.test.ts b/app/components/Views/confirmations/hooks/useSignatureMetrics.test.ts index 079b2c2f652..81b42db4be5 100644 --- a/app/components/Views/confirmations/hooks/useSignatureMetrics.test.ts +++ b/app/components/Views/confirmations/hooks/useSignatureMetrics.test.ts @@ -1,8 +1,28 @@ import { MetaMetricsEvents } from '../../../../core/Analytics'; -import { personalSignatureConfirmationState } from '../../../../util/test/confirm-data-helpers'; import { renderHookWithProvider } from '../../../../util/test/renderWithProvider'; import { useSignatureMetrics } from './useSignatureMetrics'; +const mockSigRequest = { + type: 'personal_sign', + messageParams: { + data: '0x4578616d706c652060706572736f6e616c5f7369676e60206d657373616765', + from: '0x935e73edb9ff52e23bac7f7e043a1ecd06d05477', + meta: { + url: 'https://metamask.github.io/test-dapp/', + title: 'E2E Test Dapp', + icon: { uri: 'https://metamask.github.io/metamask-fox.svg' }, + analytics: { request_source: 'In-App-Browser' }, + }, + origin: 'metamask.github.io', + metamaskId: '76b33b40-7b5c-11ef-bc0a-25bce29dbc09', + }, + chainId: '0x0', +}; + +jest.mock('./useSignatureRequest', () => ({ + useSignatureRequest: () => mockSigRequest, +})); + jest.mock('../../../../util/address', () => ({ getAddressAccountType: (str: string) => str, })); @@ -21,7 +41,7 @@ describe('useSignatureMetrics', () => { }); it('should capture metrics events correctly', async () => { const { result } = renderHookWithProvider(() => useSignatureMetrics(), { - state: personalSignatureConfirmationState, + state: {}, }); // first call for 'SIGNATURE_REQUESTED' event expect(mockTrackEvent).toHaveBeenCalledTimes(1);