mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
ccde54937f
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
36 lines
1.0 KiB
JavaScript
36 lines
1.0 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', () => {
|
|
expect(Object.keys(EndowmentPermissions).sort()).toStrictEqual(
|
|
Object.keys(endowmentPermissionBuilders)
|
|
.filter(
|
|
(targetKey) =>
|
|
!Object.keys(ExcludedSnapEndowments).includes(targetKey),
|
|
)
|
|
.sort(),
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('RestrictedMethods', () => {
|
|
it('has the expected permission keys', () => {
|
|
expect(Object.keys(RestrictedMethods).sort()).toStrictEqual(
|
|
[
|
|
'eth_accounts',
|
|
...Object.keys(restrictedMethodPermissionBuilders).filter(
|
|
(targetKey) =>
|
|
!Object.keys(ExcludedSnapPermissions).includes(targetKey),
|
|
),
|
|
].sort(),
|
|
);
|
|
});
|
|
});
|