Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeRx committed Jan 23, 2023
1 parent 13faa0f commit ee0312f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
8 changes: 6 additions & 2 deletions shared/constants/permissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ describe('EndowmentPermissions', () => {
it('has the expected permission keys', () => {
expect(Object.keys(EndowmentPermissions).sort()).toStrictEqual(
Object.keys(endowmentPermissionBuilders)
.filter((targetKey) => !ExcludedSnapEndowments.has(targetKey))
.filter(
(targetKey) =>
!Object.keys(ExcludedSnapEndowments).includes(targetKey),
)
.sort(),
);
});
Expand All @@ -23,7 +26,8 @@ describe('RestrictedMethods', () => {
[
'eth_accounts',
...Object.keys(restrictedMethodPermissionBuilders).filter(
(targetKey) => !ExcludedSnapPermissions.has(targetKey),
(targetKey) =>
!Object.keys(ExcludedSnapPermissions).includes(targetKey),
),
].sort(),
);
Expand Down
14 changes: 13 additions & 1 deletion shared/constants/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ export const PermissionNamespaces = Object.freeze({
wallet_snap_: 'wallet_snap_*',
} as const);

export const EndowmentPermissions = Object.freeze({
export const StableEndowmentPermissions = Object.freeze({
'endowment:network-access': 'endowment:network-access',
'endowment:transaction-insight': 'endowment:transaction-insight',
'endowment:cronjob': 'endowment:cronjob',
'endowment:ethereum-provider': 'endowment:ethereum-provider',
'endowment:rpc': 'endowment:rpc',
} as const);

export const FlaskEndowmentPermissions = Object.freeze({
'endowment:network-access': 'endowment:network-access',
'endowment:long-running': 'endowment:long-running',
'endowment:transaction-insight': 'endowment:transaction-insight',
Expand Down Expand Up @@ -52,6 +60,10 @@ export const ExcludedFlaskSnapEndowments = {
'endowment:keyring': 'This endowment is not available',
};

export const EndowmentPermissions = isMain
? StableEndowmentPermissions
: FlaskEndowmentPermissions;

export const ExcludedSnapPermissions = isMain
? ExcludedStableSnapPermissions
: ExcludedFlaskSnapPermissions;
Expand Down

0 comments on commit ee0312f

Please sign in to comment.