1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/shared/constants/permissions.test.js
2022-03-22 19:55:51 -07:00

29 lines
843 B
JavaScript

import { endowmentPermissionBuilders } from '@metamask/controllers';
import { restrictedMethodPermissionBuilders } from '@metamask/rpc-methods';
import {
EndowmentPermissions,
ExcludedSnapPermissions,
RestrictedMethods,
} from './permissions';
describe('EndowmentPermissions', () => {
it('has the expected permission keys', () => {
expect(Object.keys(EndowmentPermissions).sort()).toStrictEqual(
Object.keys(endowmentPermissionBuilders).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(),
);
});
});