2022-06-29 14:51:35 +02:00
|
|
|
import { endowmentPermissionBuilders } from '@metamask/snap-controllers';
|
2022-02-15 01:02:51 +01:00
|
|
|
import { restrictedMethodPermissionBuilders } from '@metamask/rpc-methods';
|
2022-03-14 20:37:19 +01:00
|
|
|
import {
|
|
|
|
EndowmentPermissions,
|
|
|
|
ExcludedSnapPermissions,
|
|
|
|
RestrictedMethods,
|
|
|
|
} from './permissions';
|
2022-02-15 01:02:51 +01:00
|
|
|
|
|
|
|
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',
|
2022-03-14 20:37:19 +01:00
|
|
|
...Object.keys(restrictedMethodPermissionBuilders).filter(
|
|
|
|
(targetKey) => !ExcludedSnapPermissions.has(targetKey),
|
|
|
|
),
|
2022-02-15 01:02:51 +01:00
|
|
|
].sort(),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|