1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00
metamask-extension/shared/constants/permissions.test.js
Frederik Bolding 7ba0f78a84
[FLASK] snaps-skunkworks@0.22.0 (#16069)
* snaps-skunkworks@0.22.0

* Update LavaMoat policies

* Bump execution environment and fix a breaking change

* Fix caveat and permissions

* Fix test

* Exclude keyring endowment for now

* Fix test

* Fix snap_confirm missing title
2022-10-07 10:02:35 +02:00

32 lines
954 B
JavaScript

import { endowmentPermissionBuilders } from '@metamask/snap-controllers';
import { restrictedMethodPermissionBuilders } from '@metamask/rpc-methods';
import {
EndowmentPermissions,
ExcludedSnapEndowments,
ExcludedSnapPermissions,
RestrictedMethods,
} from './permissions';
describe('EndowmentPermissions', () => {
it('has the expected permission keys', () => {
expect(Object.keys(EndowmentPermissions).sort()).toStrictEqual(
Object.keys(endowmentPermissionBuilders)
.filter((targetKey) => !ExcludedSnapEndowments.has(targetKey))
.sort(),
);
});
});
describe('RestrictedMethods', () => {
it('has the expected permission keys', () => {
expect(Object.keys(RestrictedMethods).sort()).toStrictEqual(
[
'eth_accounts',
...Object.keys(restrictedMethodPermissionBuilders).filter(
(targetKey) => !ExcludedSnapPermissions.has(targetKey),
),
].sort(),
);
});
});