Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit 0ed4637

Browse files
committed
Convert all keyword functions to arrow functions
1 parent 86c822f commit 0ed4637

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

src/asMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77

88
const jsonrpc = '2.0' as const;
99

10-
describe('asMiddleware', function () {
10+
describe('asMiddleware', () => {
1111
it('basic', async () => {
1212
const engine = new JsonRpcEngine();
1313
const subengine = new JsonRpcEngine();

src/createAsyncMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66

77
const jsonrpc = '2.0' as const;
88

9-
describe('createAsyncMiddleware', function () {
9+
describe('createAsyncMiddleware', () => {
1010
it('basic middleware test', async () => {
1111
const engine = new JsonRpcEngine();
1212

src/createScaffoldMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
assertIsJsonRpcFailure,
77
} from '.';
88

9-
describe('createScaffoldMiddleware', function () {
9+
describe('createScaffoldMiddleware', () => {
1010
it('basic middleware test', async () => {
1111
const engine = new JsonRpcEngine();
1212

src/engine.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import {
77

88
const jsonrpc = '2.0' as const;
99

10-
describe('JsonRpcEngine', function () {
11-
it('handle: throws on truthy, non-function callback', function () {
10+
describe('JsonRpcEngine', () => {
11+
it('handle: throws on truthy, non-function callback', () => {
1212
const engine: any = new JsonRpcEngine();
1313
expect(() => engine.handle({}, true)).toThrow(
1414
'"callback" must be a function if provided.',
1515
);
1616
});
1717

18-
it('handle: returns error for invalid request parameter', async function () {
18+
it('handle: returns error for invalid request parameter', async () => {
1919
const engine = new JsonRpcEngine();
2020
let response: any = await engine.handle(null as any);
2121
expect(response.error.code).toStrictEqual(-32600);
@@ -26,7 +26,7 @@ describe('JsonRpcEngine', function () {
2626
expect(response.result).toBeUndefined();
2727
});
2828

29-
it('handle: returns error for invalid request method', async function () {
29+
it('handle: returns error for invalid request method', async () => {
3030
const engine = new JsonRpcEngine();
3131
let response: any = await engine.handle({ method: null } as any);
3232
expect(response.error.code).toStrictEqual(-32600);
@@ -79,7 +79,7 @@ describe('JsonRpcEngine', function () {
7979
});
8080
});
8181

82-
it('handle (async): basic middleware test', async function () {
82+
it('handle (async): basic middleware test', async () => {
8383
const engine = new JsonRpcEngine();
8484

8585
engine.push(function (_req, res, _next, end) {
@@ -299,7 +299,7 @@ describe('JsonRpcEngine', function () {
299299
});
300300
});
301301

302-
it('handle: batch payloads (async signature)', async function () {
302+
it('handle: batch payloads (async signature)', async () => {
303303
const engine = new JsonRpcEngine();
304304

305305
engine.push(function (req, res, _next, end) {
@@ -329,7 +329,7 @@ describe('JsonRpcEngine', function () {
329329
expect(res[4].result).toStrictEqual(5);
330330
});
331331

332-
it('handle: batch payload with bad request object', async function () {
332+
it('handle: batch payload with bad request object', async () => {
333333
const engine = new JsonRpcEngine();
334334

335335
engine.push(function (req, res, _next, end) {
@@ -518,7 +518,7 @@ describe('JsonRpcEngine', function () {
518518
});
519519
});
520520

521-
it('handles batch request processing error (async)', async function () {
521+
it('handles batch request processing error (async)', async () => {
522522
const engine = new JsonRpcEngine();
523523
jest
524524
.spyOn(engine as any, '_promiseHandle')

src/idRemapMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { JsonRpcEngine, createIdRemapMiddleware } from '.';
22

3-
describe('idRemapMiddleware', function () {
3+
describe('idRemapMiddleware', () => {
44
it('basic middleware test', async () => {
55
const engine = new JsonRpcEngine();
66

src/mergeMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77

88
const jsonrpc = '2.0' as const;
99

10-
describe('mergeMiddleware', function () {
10+
describe('mergeMiddleware', () => {
1111
it('basic', async () => {
1212
const engine = new JsonRpcEngine();
1313
let originalReq: JsonRpcRequest<unknown>;

src/utils.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
assertIsJsonRpcFailure,
77
} from '.';
88

9-
describe('isJsonRpcSuccess', function () {
10-
it('correctly identifies JSON-RPC response objects', function () {
9+
describe('isJsonRpcSuccess', () => {
10+
it('correctly identifies JSON-RPC response objects', () => {
1111
(
1212
[
1313
[{ result: 'success' }, true],
@@ -21,8 +21,8 @@ describe('isJsonRpcSuccess', function () {
2121
});
2222
});
2323

24-
describe('isJsonRpcFailure', function () {
25-
it('correctly identifies JSON-RPC response objects', function () {
24+
describe('isJsonRpcFailure', () => {
25+
it('correctly identifies JSON-RPC response objects', () => {
2626
(
2727
[
2828
[{ error: 'failure' }, true],
@@ -36,8 +36,8 @@ describe('isJsonRpcFailure', function () {
3636
});
3737
});
3838

39-
describe('assertIsJsonRpcSuccess', function () {
40-
it('correctly identifies JSON-RPC response objects', function () {
39+
describe('assertIsJsonRpcSuccess', () => {
40+
it('correctly identifies JSON-RPC response objects', () => {
4141
([{ result: 'success' }, { result: null }] as any[]).forEach((input) => {
4242
expect(() => assertIsJsonRpcSuccess(input)).not.toThrow();
4343
});
@@ -50,8 +50,8 @@ describe('assertIsJsonRpcSuccess', function () {
5050
});
5151
});
5252

53-
describe('assertIsJsonRpcFailure', function () {
54-
it('correctly identifies JSON-RPC response objects', function () {
53+
describe('assertIsJsonRpcFailure', () => {
54+
it('correctly identifies JSON-RPC response objects', () => {
5555
([{ error: 'failure' }, { error: null }] as any[]).forEach((input) => {
5656
expect(() => assertIsJsonRpcFailure(input)).not.toThrow();
5757
});
@@ -64,7 +64,7 @@ describe('assertIsJsonRpcFailure', function () {
6464
});
6565
});
6666

67-
describe('getJsonRpcIdValidator', function () {
67+
describe('getJsonRpcIdValidator', () => {
6868
const getInputs = () => {
6969
return {
7070
// invariant with respect to options
@@ -91,7 +91,7 @@ describe('getJsonRpcIdValidator', function () {
9191
}
9292
};
9393

94-
it('performs as expected with default options', function () {
94+
it('performs as expected with default options', () => {
9595
const inputs = getInputs();
9696

9797
// The default options are:
@@ -101,7 +101,7 @@ describe('getJsonRpcIdValidator', function () {
101101
expect(() => validateAll(getJsonRpcIdValidator(), inputs)).not.toThrow();
102102
});
103103

104-
it('performs as expected with "permitEmptyString: false"', function () {
104+
it('performs as expected with "permitEmptyString: false"', () => {
105105
const inputs = getInputs();
106106
inputs.emptyString.expected = false;
107107

@@ -115,7 +115,7 @@ describe('getJsonRpcIdValidator', function () {
115115
).not.toThrow();
116116
});
117117

118-
it('performs as expected with "permitFractions: true"', function () {
118+
it('performs as expected with "permitFractions: true"', () => {
119119
const inputs = getInputs();
120120
inputs.fraction.expected = true;
121121

@@ -129,7 +129,7 @@ describe('getJsonRpcIdValidator', function () {
129129
).not.toThrow();
130130
});
131131

132-
it('performs as expected with "permitNull: false"', function () {
132+
it('performs as expected with "permitNull: false"', () => {
133133
const inputs = getInputs();
134134
inputs.null.expected = false;
135135

0 commit comments

Comments
 (0)