@@ -13,20 +13,7 @@ describe('detectContractType', () => {
13
13
// Given
14
14
const contractAddress = zeroAddress ;
15
15
const chainId = 1 ;
16
- vi . mocked ( readContract ) . mockImplementationOnce ( ( ) => Promise . resolve ( ) ) ;
17
-
18
- // When
19
- const result = await detectContractType ( contractAddress , chainId ) ;
20
-
21
- // Then
22
- expect ( result ) . toBe ( TokenType . ERC721 ) ;
23
- } ) ;
24
-
25
- it ( 'should return ERC721 for a valid ERC721 contract with invalid Token ID' , async ( ) => {
26
- // Given
27
- const contractAddress = zeroAddress ;
28
- const chainId = 1 ;
29
- vi . mocked ( readContract ) . mockImplementationOnce ( ( ) => Promise . reject ( new Error ( 'ERC721: invalid token ID' ) ) ) ;
16
+ vi . mocked ( readContract ) . mockImplementationOnce ( ( ) => Promise . resolve ( true ) ) ;
30
17
31
18
// When
32
19
const result = await detectContractType ( contractAddress , chainId ) ;
@@ -40,8 +27,8 @@ describe('detectContractType', () => {
40
27
const contractAddress = zeroAddress ;
41
28
const chainId = 1 ;
42
29
vi . mocked ( readContract )
43
- . mockImplementationOnce ( ( ) => Promise . reject ( ) )
44
- . mockImplementationOnce ( ( ) => Promise . resolve ( ) ) ;
30
+ . mockImplementationOnce ( ( ) => Promise . reject ( false ) )
31
+ . mockImplementationOnce ( ( ) => Promise . resolve ( true ) ) ;
45
32
46
33
// When
47
34
const result = await detectContractType ( contractAddress , chainId ) ;
@@ -55,8 +42,8 @@ describe('detectContractType', () => {
55
42
const contractAddress = zeroAddress ;
56
43
const chainId = 1 ;
57
44
vi . mocked ( readContract )
58
- . mockImplementationOnce ( ( ) => Promise . reject ( ) )
59
- . mockImplementationOnce ( ( ) => Promise . reject ( ) )
45
+ . mockImplementationOnce ( ( ) => Promise . reject ( new Error ( ) ) )
46
+ . mockImplementationOnce ( ( ) => Promise . reject ( new Error ( ) ) )
60
47
. mockImplementationOnce ( ( ) => Promise . resolve ( ) ) ;
61
48
62
49
// When
0 commit comments