@@ -787,23 +787,22 @@ describe('SelectedNetworkController', () => {
787
787
788
788
// TODO - improve these tests by using a full NetworkController and doing more robust behavioral testing
789
789
describe ( 'when the domain is a snap (starts with "npm:" or "local:")' , ( ) => {
790
- it ( 'returns a proxied globally selected networkClient and does not create a new proxy in the domainProxyMap ' , ( ) => {
791
- const { controller, domainProxyMap , messenger } = setup ( {
790
+ it ( 'calls to NetworkController:getSelectedNetworkClient and creates a new proxy provider and block tracker with the proxied globally selected network client ' , ( ) => {
791
+ const { controller, messenger } = setup ( {
792
792
state : {
793
793
domains : { } ,
794
794
} ,
795
- useRequestQueuePreference : true ,
795
+ useRequestQueuePreference : false ,
796
796
} ) ;
797
797
jest . spyOn ( messenger , 'call' ) ;
798
- const snapDomain = 'npm:@metamask/bip32-example-snap' ;
799
-
800
- const result = controller . getProviderAndBlockTracker ( snapDomain ) ;
801
798
802
- expect ( domainProxyMap . get ( snapDomain ) ) . toBeUndefined ( ) ;
799
+ const result = controller . getProviderAndBlockTracker ( 'npm:foo-snap' ) ;
800
+ expect ( result ) . toBeDefined ( ) ;
801
+ // unfortunately checking which networkController method is called is the best
802
+ // proxy (no pun intended) for checking that the correct instance of the networkClient is used
803
803
expect ( messenger . call ) . toHaveBeenCalledWith (
804
804
'NetworkController:getSelectedNetworkClient' ,
805
805
) ;
806
- expect ( result ) . toBeDefined ( ) ;
807
806
} ) ;
808
807
809
808
it ( 'throws an error if the globally selected network client is not initialized' , ( ) => {
0 commit comments