Skip to content

Commit e8dc3e2

Browse files
Expand assertion
1 parent c1ce02e commit e8dc3e2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

packages/snaps-controllers/src/snaps/SnapController.test.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6842,6 +6842,41 @@ describe('SnapController', () => {
68426842
'The permissions for "npm:@metamask/example-snap" were out of sync and have been automatically restored. If you see this message, please file a bug report.',
68436843
);
68446844

6845+
// We expect two calls as we mock the PermissionController to always return an empty set.
6846+
expect(snapControllerOptions.messenger.call).toHaveBeenNthCalledWith(
6847+
3,
6848+
'PermissionController:grantPermissions',
6849+
{
6850+
approvedPermissions: {
6851+
// eslint-disable-next-line @typescript-eslint/naming-convention
6852+
snap_dialog: {},
6853+
[SnapEndowments.Rpc]: {
6854+
caveats: [
6855+
{ type: 'rpcOrigin', value: { dapps: false, snaps: true } },
6856+
],
6857+
},
6858+
},
6859+
subject: { origin: MOCK_SNAP_ID },
6860+
},
6861+
);
6862+
6863+
expect(snapControllerOptions.messenger.call).toHaveBeenNthCalledWith(
6864+
6,
6865+
'PermissionController:grantPermissions',
6866+
{
6867+
approvedPermissions: {
6868+
// eslint-disable-next-line @typescript-eslint/naming-convention
6869+
snap_dialog: {},
6870+
[SnapEndowments.Rpc]: {
6871+
caveats: [
6872+
{ type: 'rpcOrigin', value: { dapps: false, snaps: true } },
6873+
],
6874+
},
6875+
},
6876+
subject: { origin: MOCK_SNAP_ID },
6877+
},
6878+
);
6879+
68456880
snapController.destroy();
68466881
});
68476882

0 commit comments

Comments
 (0)