Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Aug 25, 2022
1 parent 8ede293 commit d3beb6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/scripts/controllers/permissions/specifications.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SnapCaveatType } from '@metamask/rpc-methods';
import {
CaveatTypes,
RestrictedMethods,
Expand All @@ -15,14 +16,16 @@ describe('PermissionController specifications', () => {
describe('caveat specifications', () => {
it('getCaveatSpecifications returns the expected specifications object', () => {
const caveatSpecifications = getCaveatSpecifications({});
expect(Object.keys(caveatSpecifications)).toHaveLength(2);
expect(Object.keys(caveatSpecifications)).toHaveLength(3);
expect(
caveatSpecifications[CaveatTypes.restrictReturnedAccounts].type,
).toStrictEqual(CaveatTypes.restrictReturnedAccounts);

// TODO: Use `SnapCaveatType` from `rpc-methods` when it's exported.
expect(caveatSpecifications.permittedDerivationPaths.type).toStrictEqual(
'permittedDerivationPaths',
SnapCaveatType.PermittedDerivationPaths,
);
expect(caveatSpecifications.permittedCoinTypes.type).toStrictEqual(
SnapCaveatType.PermittedCoinTypes,
);
});

Expand Down
2 changes: 2 additions & 0 deletions shared/constants/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const RestrictedMethods = Object.freeze({
snap_notify: 'snap_notify',
snap_manageState: 'snap_manageState',
snap_getBip32Entropy: 'snap_getBip32Entropy',
snap_getBip44Entropy: 'snap_getBip44Entropy',
'snap_getBip44Entropy_*': 'snap_getBip44Entropy_*',
'wallet_snap_*': 'wallet_snap_*',
///: END:ONLY_INCLUDE_IN
Expand All @@ -23,6 +24,7 @@ export const PermissionNamespaces = Object.freeze({
export const EndowmentPermissions = Object.freeze({
'endowment:network-access': 'endowment:network-access',
'endowment:long-running': 'endowment:long-running',
'endowment:transaction-insight': 'endowment:transaction-insight',
} as const);

// Methods / permissions in external packages that we are temporarily excluding.
Expand Down

0 comments on commit d3beb6e

Please sign in to comment.