Skip to content

Commit 55328a6

Browse files
committed
Fix a test
1 parent 3555e2b commit 55328a6

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
@@ -634,23 +634,22 @@ describe('SelectedNetworkController', () => {
634634

635635
// TODO - improve these tests by using a full NetworkController and doing more robust behavioral testing
636636
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({
639639
state: {
640640
domains: {},
641641
},
642-
useRequestQueuePreference: true,
642+
useRequestQueuePreference: false,
643643
});
644644
jest.spyOn(messenger, 'call');
645-
const snapDomain = 'npm:@metamask/bip32-example-snap';
646-
647-
const result = controller.getProviderAndBlockTracker(snapDomain);
648645

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
650650
expect(messenger.call).toHaveBeenCalledWith(
651651
'NetworkController:getSelectedNetworkClient',
652652
);
653-
expect(result).toBeDefined();
654653
});
655654

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

0 commit comments

Comments
 (0)