1
1
import { randomUUID } from 'crypto' ;
2
- import { act , fireEvent , screen } from '@testing-library/react' ;
3
2
import { ApprovalType } from '@metamask/controller-utils' ;
3
+ import { act , fireEvent , screen } from '@testing-library/react' ;
4
4
import nock from 'nock' ;
5
- import mockMetaMaskState from '../../data/integration-init-state.json' ;
6
- import { integrationTestRender } from '../../../lib/render-helpers' ;
5
+ import { useAssetDetails } from '../../../../ui/pages/confirmations/hooks/useAssetDetails' ;
7
6
import * as backgroundConnection from '../../../../ui/store/background-connection' ;
8
- import { createMockImplementation , mock4byte } from '../../helpers' ;
7
+ import { integrationTestRender } from '../../../lib/render- helpers' ;
9
8
import { createTestProviderTools } from '../../../stub/provider' ;
9
+ import mockMetaMaskState from '../../data/integration-init-state.json' ;
10
+ import { createMockImplementation , mock4byte } from '../../helpers' ;
10
11
import { getUnapprovedApproveTransaction } from './transactionDataHelpers' ;
11
12
12
13
jest . mock ( '../../../../ui/store/background-connection' , ( ) => ( {
@@ -15,7 +16,17 @@ jest.mock('../../../../ui/store/background-connection', () => ({
15
16
callBackgroundMethod : jest . fn ( ) ,
16
17
} ) ) ;
17
18
19
+ jest . mock ( '../../../../ui/pages/confirmations/hooks/useAssetDetails' , ( ) => ( {
20
+ ...jest . requireActual (
21
+ '../../../../ui/pages/confirmations/hooks/useAssetDetails' ,
22
+ ) ,
23
+ useAssetDetails : jest . fn ( ) . mockResolvedValue ( {
24
+ decimals : '4' ,
25
+ } ) ,
26
+ } ) ) ;
27
+
18
28
const mockedBackgroundConnection = jest . mocked ( backgroundConnection ) ;
29
+ const mockedAssetDetails = jest . mocked ( useAssetDetails ) ;
19
30
20
31
const backgroundConnectionMocked = {
21
32
onNotification : jest . fn ( ) ,
@@ -92,6 +103,10 @@ describe('Contract Interaction Confirmation Alerts', () => {
92
103
setupSubmitRequestToBackgroundMocks ( ) ;
93
104
const APPROVE_NFT_HEX_SIG = '0x095ea7b3' ;
94
105
mock4byte ( APPROVE_NFT_HEX_SIG ) ;
106
+ mockedAssetDetails . mockImplementation ( ( ) => ( {
107
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
+ decimals : '4' as any ,
109
+ } ) ) ;
95
110
} ) ;
96
111
97
112
afterEach ( ( ) => {
0 commit comments