mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 15:50:28 +01:00
4d015de43e
* Fence snaps endowments and permissions for stable/flask * Fix lint * Fix tests * Actually fix tests * Fix another test
38 lines
1.1 KiB
JavaScript
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(
|
|
(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(),
|
|
);
|
|
});
|
|
});
|