1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00
metamask-extension/shared/constants/permissions.test.js
Frederik Bolding f03f2d3f79
[FLASK] snaps@0.34.0-flask.1 (#19377)
* snaps@0.34.0-flask.1

* Update LavaMoat policies

* Replace instances of targetKey with targetName

* Replace use of PermissionKeys with PermissionNames

* Use Flask packages in tests for now

* Bump execution env

* Add another mock

* Fix lint
2023-06-05 13:51:19 +02:00

38 lines
1.1 KiB
JavaScript

import { endowmentPermissionBuilders } from '@metamask/snaps-controllers';
import { restrictedMethodPermissionBuilders } from '@metamask/rpc-methods';
import {
EndowmentPermissions,
ExcludedSnapEndowments,
ExcludedSnapPermissions,
RestrictedMethods,
} from './permissions';
describe('EndowmentPermissions', () => {
it('has the expected permission keys', () => {
// Since long-running is fenced out this causes problems with the test, we re-add it here.
expect(Object.keys(EndowmentPermissions).sort()).toStrictEqual(
[
'endowment:long-running',
...Object.keys(endowmentPermissionBuilders).filter(
(targetName) =>
!Object.keys(ExcludedSnapEndowments).includes(targetName),
),
].sort(),
);
});
});
describe('RestrictedMethods', () => {
it('has the expected permission keys', () => {
expect(Object.keys(RestrictedMethods).sort()).toStrictEqual(
[
'eth_accounts',
...Object.keys(restrictedMethodPermissionBuilders).filter(
(targetName) =>
!Object.keys(ExcludedSnapPermissions).includes(targetName),
),
].sort(),
);
});
});