Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuri committed Jan 13, 2025
1 parent 08cf32b commit aa7777f
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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,
}));
Expand All @@ -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);
Expand Down

0 comments on commit aa7777f

Please sign in to comment.