@@ -9,35 +9,28 @@ import (
99 "github.com/stretchr/testify/assert"
1010)
1111
12+ // mock/nft_mock_test.go
1213func TestMockNFTDetector (t * testing.T ) {
13- detector := NewMockNFTDetector ()
14-
1514 t .Run ("Known contract" , func (t * testing.T ) {
16- detector .Reset ()
17- address := common .HexToAddress ("0xBAYC" )
18- detector .AddKnownContract (address )
15+ detector := NewMockNFTDetector () // Create fresh instance
16+
17+ contractAddr := common .HexToAddress ("0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" )
18+
19+ // Verify initial state
20+ val , exists := detector .knownContracts .Load (contractAddr )
21+ assert .True (t , exists , "Contract should be in initial known contracts" )
22+ assert .True (t , val .(bool ), "Contract should be marked as valid" )
1923
20- // Create transaction to the known contract address
2124 tx := types .NewTransaction (
2225 0 ,
23- address ,
26+ contractAddr ,
2427 big .NewInt (0 ),
2528 21000 ,
2629 big .NewInt (1 ),
2730 nil ,
2831 )
2932
30- // Add debug assertions
31- toAddr := tx .To ()
32- if toAddr == nil {
33- t .Fatal ("Transaction To address is nil" )
34- }
35-
36- // Verify the addresses match
37- assert .Equal (t , address , * toAddr , "Transaction address should match known contract" )
38-
39- // Check if transaction is detected as NFT
4033 result := detector .IsNFTTransaction (tx )
41- assert .True (t , result , "Transaction to known NFT contract address should return true " )
34+ assert .True (t , result , "Transaction to known NFT contract should be detected " )
4235 })
4336}
0 commit comments