Skip to content

Commit

Permalink
update @metamask/utils v7 usage
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Aug 24, 2023
1 parent e4f1a74 commit 1994135
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/middleware/createRpcWarningMiddleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('createRpcWarningMiddleware', () => {
method,
})) as JsonRpcFailure;

expect(result.error.message).toBe('Failure!');
expect(result.error.message).toBe('Internal JSON-RPC error.');
});
});

Expand Down Expand Up @@ -159,7 +159,7 @@ describe('createRpcWarningMiddleware', () => {
params,
})) as JsonRpcFailure;

expect(result.error.message).toBe('Failure!');
expect(result.error.message).toBe('Internal JSON-RPC error.');
});
});
});
6 changes: 4 additions & 2 deletions test/mocks/MockConnectionStream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {
Json,
JsonRpcNotification,
JsonRpcParams,
JsonRpcRequest,
JsonRpcResponse,
} from '@metamask/utils';
Expand Down Expand Up @@ -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<Json>) {
this.push({ name: substream, data: message });
}

Expand All @@ -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<unknown>) {
notify(substream: string, message: JsonRpcNotification<JsonRpcParams>) {

Check failure on line 86 in test/mocks/MockConnectionStream.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (16.x)

This is the default value for this type parameter, so it can be omitted

Check failure on line 86 in test/mocks/MockConnectionStream.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

This is the default value for this type parameter, so it can be omitted

Check failure on line 86 in test/mocks/MockConnectionStream.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

This is the default value for this type parameter, so it can be omitted
this.push({ name: substream, data: message });
}
}
3 changes: 2 additions & 1 deletion test/mocks/MockPort.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
Json,
JsonRpcNotification,
JsonRpcRequest,
JsonRpcResponse,
Expand Down Expand Up @@ -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<Json>) {
if (!this.#connected) {
throw new Error(
'It is not possible to reply after the port has disconnected',
Expand Down

0 comments on commit 1994135

Please sign in to comment.