@@ -13,6 +13,8 @@ import (
1313 "go.uber.org/mock/gomock"
1414)
1515
16+ const testChainID uint64 = 1
17+
1618type OrderTestSuite struct {
1719 suite.Suite
1820 fetcher * lifi.LifiEventFetcher
@@ -28,13 +30,23 @@ func (s *OrderTestSuite) SetupTest() {
2830 ctrl := gomock .NewController (s .T ())
2931 s .mockClient = mock_lifi .NewMockReceiptFetcher (ctrl )
3032 s .inputSettler = common .HexToAddress ("0x000025c3226C00B2Cdc200005a1600509f4e00C0" )
31- s .fetcher = lifi .NewLifiEventFetcher (s .mockClient , s .inputSettler )
33+ clients := map [uint64 ]lifi.ReceiptFetcher {
34+ testChainID : s .mockClient ,
35+ }
36+ s .fetcher = lifi .NewLifiEventFetcher (clients , s .inputSettler )
37+ }
38+
39+ func (s * OrderTestSuite ) Test_Order_UnsupportedChain () {
40+ _ , err := s .fetcher .Order (context .Background (), 999 , common.Hash {}, common.Hash {})
41+
42+ s .NotNil (err )
43+ s .Contains (err .Error (), "no client configured for source chain 999" )
3244}
3345
3446func (s * OrderTestSuite ) Test_Order_FetchingTxFails () {
3547 s .mockClient .EXPECT ().TransactionReceipt (gomock .Any (), gomock .Any ()).Return (nil , fmt .Errorf ("error" ))
3648
37- _ , err := s .fetcher .Order (context .Background (), common.Hash {}, common.Hash {})
49+ _ , err := s .fetcher .Order (context .Background (), testChainID , common.Hash {}, common.Hash {})
3850
3951 s .NotNil (err )
4052}
@@ -44,7 +56,7 @@ func (s *OrderTestSuite) Test_Order_NoEvents() {
4456 Logs : make ([]* types.Log , 0 ),
4557 }, nil )
4658
47- _ , err := s .fetcher .Order (context .Background (), common.Hash {}, common.Hash {})
59+ _ , err := s .fetcher .Order (context .Background (), testChainID , common.Hash {}, common.Hash {})
4860
4961 s .NotNil (err )
5062}
@@ -87,7 +99,7 @@ func (s *OrderTestSuite) Test_Order_InvalidLogs() {
8799 },
88100 }, nil )
89101
90- _ , err := s .fetcher .Order (context .Background (), common.Hash {}, common.Hash {})
102+ _ , err := s .fetcher .Order (context .Background (), testChainID , common.Hash {}, common.Hash {})
91103
92104 s .NotNil (err )
93105}
0 commit comments