diff --git a/packages/permission-controller/src/rpc-methods/getPermissions.test.ts b/packages/permission-controller/src/rpc-methods/getPermissions.test.ts index 99e0d02c48..f7724f4617 100644 --- a/packages/permission-controller/src/rpc-methods/getPermissions.test.ts +++ b/packages/permission-controller/src/rpc-methods/getPermissions.test.ts @@ -14,13 +14,16 @@ describe('getPermissions RPC method', () => { const engine = new JsonRpcEngine(); engine.push( - async ( + ( req: JsonRpcRequest<[]>, res: PendingJsonRpcResponse, next, end, ) => { - await implementation(req, res, next, end, { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { getPermissionsForOrigin: mockGetPermissionsForOrigin, }); }, @@ -44,13 +47,16 @@ describe('getPermissions RPC method', () => { const engine = new JsonRpcEngine(); engine.push( - async ( + ( req: JsonRpcRequest<[]>, res: PendingJsonRpcResponse, next, end, ) => { - await implementation(req, res, next, end, { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { getPermissionsForOrigin: mockGetPermissionsForOrigin, }); }, diff --git a/packages/permission-controller/src/rpc-methods/requestPermissions.test.ts b/packages/permission-controller/src/rpc-methods/requestPermissions.test.ts index 6d467910d1..77dfc93ae5 100644 --- a/packages/permission-controller/src/rpc-methods/requestPermissions.test.ts +++ b/packages/permission-controller/src/rpc-methods/requestPermissions.test.ts @@ -32,8 +32,11 @@ describe('requestPermissions RPC method', () => { const engine = new JsonRpcEngine(); engine.push<[RequestedPermissions], PermissionConstraint[]>( - async (req, res, next, end) => { - await implementation(req, res, next, end, { + (req, res, next, end) => { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { requestPermissionsForOrigin: mockRequestPermissionsForOrigin, }); }, @@ -102,8 +105,11 @@ describe('requestPermissions RPC method', () => { const engine = new JsonRpcEngine(); engine.push<[RequestedPermissions], PermissionConstraint[]>( - async (req, res, next, end) => { - await implementation(req, res, next, end, { + (req, res, next, end) => { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { requestPermissionsForOrigin: mockRequestPermissionsForOrigin, }); }, diff --git a/packages/permission-controller/src/rpc-methods/revokePermissions.test.ts b/packages/permission-controller/src/rpc-methods/revokePermissions.test.ts index 8a77226df5..5d9a9fdc21 100644 --- a/packages/permission-controller/src/rpc-methods/revokePermissions.test.ts +++ b/packages/permission-controller/src/rpc-methods/revokePermissions.test.ts @@ -27,8 +27,11 @@ describe('revokePermissions RPC method', () => { const mockRevokePermissionsForOrigin = jest.fn(); const engine = new JsonRpcEngine(); - engine.push(async (req, res, next, end) => { - await implementation(req, res, next, end, { + engine.push((req, res, next, end) => { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { revokePermissionsForOrigin: mockRevokePermissionsForOrigin, }); }); @@ -57,8 +60,11 @@ describe('revokePermissions RPC method', () => { const mockRevokePermissionsForOrigin = jest.fn(); const engine = new JsonRpcEngine(); - engine.push(async (req, res, next, end) => { - await implementation(req, res, next, end, { + engine.push((req, res, next, end) => { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { revokePermissionsForOrigin: mockRevokePermissionsForOrigin, }); }); @@ -91,8 +97,11 @@ describe('revokePermissions RPC method', () => { const mockRevokePermissionsForOrigin = jest.fn(); const engine = new JsonRpcEngine(); - engine.push(async (req, res, next, end) => { - await implementation(req, res, next, end, { + engine.push((req, res, next, end) => { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { revokePermissionsForOrigin: mockRevokePermissionsForOrigin, }); }); @@ -125,8 +134,11 @@ describe('revokePermissions RPC method', () => { const mockRevokePermissionsForOrigin = jest.fn(); const engine = new JsonRpcEngine(); - engine.push(async (req, res, next, end) => { - await implementation(req, res, next, end, { + engine.push((req, res, next, end) => { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { revokePermissionsForOrigin: mockRevokePermissionsForOrigin, }); }); @@ -158,8 +170,11 @@ describe('revokePermissions RPC method', () => { const mockRevokePermissionsForOrigin = jest.fn(); const engine = new JsonRpcEngine(); - engine.push(async (req, res, next, end) => { - await implementation(req, res, next, end, { + engine.push((req, res, next, end) => { + // We intentionally do not await this promise; JsonRpcEngine won't await + // middleware anyway. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + implementation(req, res, next, end, { revokePermissionsForOrigin: mockRevokePermissionsForOrigin, }); });