Skip to content

Commit

Permalink
[WIP] Test
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeRx committed Nov 22, 2024
1 parent c2dca1a commit 6df462c
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions packages/snaps-controllers/src/snaps/SnapController.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1034,15 +1034,32 @@ describe('SnapController', () => {
}),
);

const snap = await snapController.installSnaps(MOCK_ORIGIN, {
await snapController.installSnaps(MOCK_ORIGIN, {
[MOCK_SNAP_ID]: {},
});

const permissions = (snap[MOCK_SNAP_ID] as Snap).initialPermissions;

expect(permissions).toStrictEqual({
[handlerEndowments.onRpcRequest as string]: { snaps: false, dapps: true },
});
expect(messenger.call).toHaveBeenNthCalledWith(
5,
'PermissionController:grantPermissions',
{
approvedPermissions: {
[SnapEndowments.Rpc]: {
caveats: [
{ type: 'rpcOrigin', value: { dapps: true, snaps: false } },
],
},
},
subject: { origin: MOCK_SNAP_ID },
requestData: {
metadata: {
dappOrigin: MOCK_ORIGIN,
id: expect.any(String),
origin: MOCK_SNAP_ID,
},
snapId: MOCK_SNAP_ID,
},
},
);

snapController.destroy();
});
Expand Down

0 comments on commit 6df462c

Please sign in to comment.