@@ -634,23 +634,22 @@ describe('SelectedNetworkController', () => {
634
634
635
635
// TODO - improve these tests by using a full NetworkController and doing more robust behavioral testing
636
636
describe ( 'when the domain is a snap (starts with "npm:" or "local:")' , ( ) => {
637
- it ( 'returns a proxied globally selected networkClient and does not create a new proxy in the domainProxyMap ' , ( ) => {
638
- const { controller, domainProxyMap , messenger } = setup ( {
637
+ it ( 'calls to NetworkController:getSelectedNetworkClient and creates a new proxy provider and block tracker with the proxied globally selected network client ' , ( ) => {
638
+ const { controller, messenger } = setup ( {
639
639
state : {
640
640
domains : { } ,
641
641
} ,
642
- useRequestQueuePreference : true ,
642
+ useRequestQueuePreference : false ,
643
643
} ) ;
644
644
jest . spyOn ( messenger , 'call' ) ;
645
- const snapDomain = 'npm:@metamask/bip32-example-snap' ;
646
-
647
- const result = controller . getProviderAndBlockTracker ( snapDomain ) ;
648
645
649
- expect ( domainProxyMap . get ( snapDomain ) ) . toBeUndefined ( ) ;
646
+ const result = controller . getProviderAndBlockTracker ( 'npm:foo-snap' ) ;
647
+ expect ( result ) . toBeDefined ( ) ;
648
+ // unfortunately checking which networkController method is called is the best
649
+ // proxy (no pun intended) for checking that the correct instance of the networkClient is used
650
650
expect ( messenger . call ) . toHaveBeenCalledWith (
651
651
'NetworkController:getSelectedNetworkClient' ,
652
652
) ;
653
- expect ( result ) . toBeDefined ( ) ;
654
653
} ) ;
655
654
656
655
it ( 'throws an error if the globally selected network client is not initialized' , ( ) => {
0 commit comments