Skip to content

Commit 207cfd8

Browse files
committed
Fix a test
1 parent 3c95dfd commit 207cfd8

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

packages/selected-network-controller/tests/SelectedNetworkController.test.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -787,23 +787,22 @@ describe('SelectedNetworkController', () => {
787787

788788
// TODO - improve these tests by using a full NetworkController and doing more robust behavioral testing
789789
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({
792792
state: {
793793
domains: {},
794794
},
795-
useRequestQueuePreference: true,
795+
useRequestQueuePreference: false,
796796
});
797797
jest.spyOn(messenger, 'call');
798-
const snapDomain = 'npm:@metamask/bip32-example-snap';
799-
800-
const result = controller.getProviderAndBlockTracker(snapDomain);
801798

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
803803
expect(messenger.call).toHaveBeenCalledWith(
804804
'NetworkController:getSelectedNetworkClient',
805805
);
806-
expect(result).toBeDefined();
807806
});
808807

809808
it('throws an error if the globally selected network client is not initialized', () => {

0 commit comments

Comments
 (0)