Skip to content

Commit

Permalink
fix tests + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 committed Jul 15, 2024
1 parent 7289b04 commit e2c1f68
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 0 additions & 2 deletions app/scripts/lib/multichain-api/caip25permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
type NonEmptyArray,
} from '@metamask/utils';
import { NetworkClientId } from '@metamask/network-controller';
import { InternalAccount } from '@metamask/keyring-api';
import { cloneDeep, isEqual } from 'lodash';
import {
Scope,
Expand Down Expand Up @@ -58,7 +57,6 @@ type Caip25EndowmentSpecification = ValidPermissionSpecification<{
*
* @param builderOptions - The specification builder options.
* @param builderOptions.findNetworkClientIdByChainId
* @param builderOptions.getInternalAccounts
* @returns The specification for the `caip25` endowment.
*/
const specificationBuilder: PermissionSpecificationBuilder<
Expand Down
5 changes: 0 additions & 5 deletions app/scripts/lib/multichain-api/scope/assert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ describe('Scope Assert', () => {

describe('assertScopeSupported', () => {
const findNetworkClientIdByChainId = jest.fn();
const getInternalAccounts = jest.fn();

describe('scopeString', () => {
it('checks if the scopeString is supported', () => {
try {
Expand Down Expand Up @@ -66,7 +64,6 @@ describe('Scope Assert', () => {
},
{
findNetworkClientIdByChainId,
getInternalAccounts,
},
);
}).toThrow(
Expand Down Expand Up @@ -139,8 +136,6 @@ describe('Scope Assert', () => {

describe('assertScopesSupported', () => {
const findNetworkClientIdByChainId = jest.fn();
const getInternalAccounts = jest.fn();

it('throws an error if no scopes are defined', () => {
expect(() => {
assertScopesSupported(
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/multichain-api/scope/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const assertScopeSupported = (
'Requested notifications are not supported',
);
}

};

export const assertScopesSupported = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import {
assertIsJsonRpcFailure,
assertIsJsonRpcSuccess,
} from '@metamask/utils';
import { createMethodMiddleware, createLegacyMethodMiddleware } from '.';
import {
createEip1193MethodMiddleware,
createEthAccountsMethodMiddleware,
createMultichainMethodMiddleware,
} from '.';

jest.mock('@metamask/permission-controller', () => ({
permissionRpcMethods: { handlers: [] },
Expand Down Expand Up @@ -39,13 +43,15 @@ jest.mock('./handlers', () => {

return {
handlers: [getHandler()],
legacyHandlers: [getHandler()],
eip1193OnlyHandlers: [getHandler()],
ethAccountsHandler: getHandler(),
};
});

describe.each([
['createMethodMiddleware', createMethodMiddleware],
['createLegacyMethodMiddleware', createLegacyMethodMiddleware],
['createEip1193MethodMiddleware', createEip1193MethodMiddleware],
['createEthAccountsMethodMiddleware', createEthAccountsMethodMiddleware],
['createMultichainMethodMiddleware', createMultichainMethodMiddleware],
])('%s', (_name, createMiddleware) => {
const method1 = 'method1';

Expand Down
7 changes: 5 additions & 2 deletions app/scripts/metamask-controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ const createLoggerMiddlewareMock = () => (req, res, next) => {
jest.mock('./lib/createLoggerMiddleware', () => createLoggerMiddlewareMock);

const rpcMethodMiddlewareMock = {
createMethodMiddleware: () => (_req, _res, next, _end) => {
createEip1193MethodMiddleware: () => (_req, _res, next, _end) => {
next();
},
createLegacyMethodMiddleware: () => (_req, _res, next, _end) => {
createEthAccountsMethodMiddleware: () => (_req, _res, next, _end) => {
next();
},
createMultichainMethodMiddleware: () => (_req, _res, next, _end) => {
next();
},
createUnsupportedMethodMiddleware: () => (_req, _res, next, _end) => {
Expand Down

0 comments on commit e2c1f68

Please sign in to comment.