From 1994135925d72158ca9a8268736ae23009381180 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Thu, 24 Aug 2023 05:20:17 +0000 Subject: [PATCH] update @metamask/utils v7 usage --- src/middleware/createRpcWarningMiddleware.test.ts | 4 ++-- test/mocks/MockConnectionStream.ts | 6 ++++-- test/mocks/MockPort.ts | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/middleware/createRpcWarningMiddleware.test.ts b/src/middleware/createRpcWarningMiddleware.test.ts index d3bdf120..90ffb112 100644 --- a/src/middleware/createRpcWarningMiddleware.test.ts +++ b/src/middleware/createRpcWarningMiddleware.test.ts @@ -109,7 +109,7 @@ describe('createRpcWarningMiddleware', () => { method, })) as JsonRpcFailure; - expect(result.error.message).toBe('Failure!'); + expect(result.error.message).toBe('Internal JSON-RPC error.'); }); }); @@ -159,7 +159,7 @@ describe('createRpcWarningMiddleware', () => { params, })) as JsonRpcFailure; - expect(result.error.message).toBe('Failure!'); + expect(result.error.message).toBe('Internal JSON-RPC error.'); }); }); }); diff --git a/test/mocks/MockConnectionStream.ts b/test/mocks/MockConnectionStream.ts index d421ac48..8972fab6 100644 --- a/test/mocks/MockConnectionStream.ts +++ b/test/mocks/MockConnectionStream.ts @@ -1,5 +1,7 @@ import { + Json, JsonRpcNotification, + JsonRpcParams, JsonRpcRequest, JsonRpcResponse, } from '@metamask/utils'; @@ -71,7 +73,7 @@ export class MockConnectionStream extends Duplex { * @param substream - The substream this reply is included in. * @param message - The JSON RPC response. */ - reply(substream: string, message: JsonRpcResponse) { + reply(substream: string, message: JsonRpcResponse) { this.push({ name: substream, data: message }); } @@ -81,7 +83,7 @@ export class MockConnectionStream extends Duplex { * @param substream - The substream this notification is included in. * @param message - The JSON RPC notification. */ - notify(substream: string, message: JsonRpcNotification) { + notify(substream: string, message: JsonRpcNotification) { this.push({ name: substream, data: message }); } } diff --git a/test/mocks/MockPort.ts b/test/mocks/MockPort.ts index 5c22a542..6e916170 100644 --- a/test/mocks/MockPort.ts +++ b/test/mocks/MockPort.ts @@ -1,4 +1,5 @@ import { + Json, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, @@ -77,7 +78,7 @@ export class MockPort { * @param substream - The substream this reply is included in. * @param message - The JSON RPC response. */ - reply(substream: string, message: JsonRpcResponse) { + reply(substream: string, message: JsonRpcResponse) { if (!this.#connected) { throw new Error( 'It is not possible to reply after the port has disconnected',