Skip to content

Commit 265a4a9

Browse files
committed
wip: fixing up tests
[ci skip]
1 parent 6b65eb1 commit 265a4a9

21 files changed

+204
-527
lines changed

src/nodes/NodeConnection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { CreateDestroy } from '@matrixai/async-init/dist/CreateDestroy';
1212
import { timedCancellable, context } from '@matrixai/contexts/dist/decorators';
1313
import { Evented } from '@matrixai/events';
1414
import { QUICClient, events as quicEvents } from '@matrixai/quic';
15-
import { QUICClientEvent } from '@matrixai/quic/dist/events';
1615
import * as nodesErrors from './errors';
1716
import * as nodesEvents from './events';
1817
import RPCClient from '../rpc/RPCClient';

src/nodes/NodeConnectionManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class NodeConnectionManager {
281281
}
282282

283283
public async start({
284-
host = '::' as Host,
284+
host = '::' as Host, // FIXME: Should just be string and number
285285
port = 0 as Port,
286286
reuseAddr = false,
287287
ipv6Only = false,

src/nodes/NodeManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class NodeManager {
199199
handleNodeConnectionEvent = (
200200
e: nodesEvents.EventNodeConnectionManagerConnection,
201201
) => {
202-
this.setNode(
202+
void this.setNode(
203203
e.detail.remoteNodeId,
204204
{
205205
host: e.detail.remoteHost,

src/nodes/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { QUICStream } from '@matrixai/quic';
2-
import type { ConnectionData } from '@/network/types';
2+
import type { ConnectionData } from '../network/types';
33
import { AbstractEvent } from '@matrixai/events';
44

55
abstract class EventsNode<T> extends AbstractEvent<T> {}

tests/agent/handlers/nodesClaimsGet.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { IdentityId, ProviderId } from '@/identities/types';
22
import type { ClaimIdEncoded } from '@/ids';
33
import type * as quicEvents from '@matrixai/quic/dist/events';
4-
import type { Host as QUICHost } from '@matrixai/quic';
54
import fs from 'fs';
65
import path from 'path';
76
import os from 'os';
@@ -26,7 +25,7 @@ describe('nodesClaimsGet', () => {
2625
]);
2726
const password = 'password';
2827
const crypto = tlsTestsUtils.createCrypto();
29-
const localHost = '127.0.0.1' as QUICHost;
28+
const localHost = '127.0.0.1';
3029

3130
let dataDir: string;
3231

tests/agent/handlers/nodesClosestLocalNode.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type * as quicEvents from '@matrixai/quic/dist/events';
2-
import type { Host as QUICHost } from '@matrixai/quic';
32
import type { NodeIdEncoded } from '@/ids';
43
import type { Host, Port } from '@/network/types';
54
import fs from 'fs';
@@ -25,7 +24,7 @@ describe('nodesClosestLocalNode', () => {
2524
]);
2625
const password = 'password';
2726
const crypto = tlsTestsUtils.createCrypto();
28-
const localHost = '127.0.0.1' as QUICHost;
27+
const localHost = '127.0.0.1';
2928

3029
let dataDir: string;
3130

tests/agent/handlers/nodesCrossSignClaim.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type * as quicEvents from '@matrixai/quic/dist/events';
2-
import type { Host as QUICHost } from '@matrixai/quic';
32
import type NodeConnectionManager from '@/nodes/NodeConnectionManager';
43
import type { AgentClaimMessage } from '@/agent/handlers/types';
54
import type { NodeId } from '@/ids';
@@ -35,7 +34,7 @@ describe('nodesCrossSignClaim', () => {
3534
]);
3635
const password = 'password';
3736
const crypto = tlsTestsUtils.createCrypto();
38-
const localHost = '127.0.0.1' as QUICHost;
37+
const localHost = '127.0.0.1';
3938

4039
let dataDir: string;
4140

tests/agent/handlers/nodesHolePunchMessage.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type * as quicEvents from '@matrixai/quic/dist/events';
2-
import type { Host as QUICHost } from '@matrixai/quic';
32
import type GestaltGraph from '../../../src/gestalts/GestaltGraph';
43
import fs from 'fs';
54
import path from 'path';
@@ -28,7 +27,7 @@ describe('nodesHolePunchMessage', () => {
2827
]);
2928
const password = 'password';
3029
const crypto = tlsTestsUtils.createCrypto();
31-
const localHost = '127.0.0.1' as QUICHost;
30+
const localHost = '127.0.0.1';
3231

3332
let dataDir: string;
3433

tests/agent/handlers/notificationsSend.test.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type * as quicEvents from '@matrixai/quic/dist/events';
2-
import type { Host as QUICHost } from '@matrixai/quic';
32
import type { Notification, SignedNotification } from '@/notifications/types';
43
import type { NodeId } from '@/ids';
54
import type GestaltGraph from '../../../src/gestalts/GestaltGraph';
5+
import type { Host } from '@/network/types';
66
import fs from 'fs';
77
import path from 'path';
88
import os from 'os';
99
import Logger, { LogLevel, StreamHandler } from '@matrixai/logger';
10-
import { QUICClient, QUICServer, QUICSocket } from '@matrixai/quic';
10+
import { QUICClient, QUICServer } from '@matrixai/quic';
1111
import { DB } from '@matrixai/db';
1212
import RPCClient from '@/rpc/RPCClient';
1313
import RPCServer from '@/rpc/RPCServer';
@@ -36,7 +36,7 @@ describe('notificationsSend', () => {
3636
]);
3737
const password = 'password';
3838
const crypto = tlsTestsUtils.createCrypto();
39-
const localHost = '127.0.0.1' as QUICHost;
39+
const localHost = '127.0.0.1' as Host;
4040

4141
let dataDir: string;
4242

@@ -46,7 +46,6 @@ describe('notificationsSend', () => {
4646
let acl: ACL;
4747
let sigchain: Sigchain;
4848
let taskManager: TaskManager;
49-
let quicSocket: QUICSocket;
5049
let nodeConnectionManager: NodeConnectionManager;
5150
let nodeManager: NodeManager;
5251
let notificationsManager: NotificationsManager;
@@ -118,23 +117,15 @@ describe('notificationsSend', () => {
118117
logger,
119118
lazy: true,
120119
});
121-
quicSocket = new QUICSocket({
122-
logger,
123-
});
124-
await quicSocket.start({
125-
host: localHost,
126-
});
127120
const tlsConfigClient = await tlsTestsUtils.createTLSConfig(
128121
keyRing.keyPair,
129122
);
130123
nodeConnectionManager = new NodeConnectionManager({
131124
tlsConfig: tlsConfigClient,
132-
crypto,
133-
quicSocket,
134125
keyRing,
135126
nodeGraph,
136-
connectionConnectTime: 2000,
137-
connectionTimeoutTime: 2000,
127+
connectionConnectTimeoutTime: 2000,
128+
connectionIdleTimeoutTime: 2000,
138129
logger: logger.getChild('NodeConnectionManager'),
139130
});
140131
nodeManager = new NodeManager({
@@ -148,7 +139,7 @@ describe('notificationsSend', () => {
148139
logger,
149140
});
150141
await nodeManager.start();
151-
await nodeConnectionManager.start({ nodeManager, handleStream: () => {} });
142+
await nodeConnectionManager.start({ host: localHost });
152143
await taskManager.startProcessing();
153144
notificationsManager =
154145
await NotificationsManager.createNotificationsManager({
@@ -253,7 +244,6 @@ describe('notificationsSend', () => {
253244
await notificationsManager.stop();
254245
await nodeManager.stop();
255246
await nodeConnectionManager.stop();
256-
await quicSocket.stop();
257247
await sigchain.stop();
258248
await acl.stop();
259249
await nodeGraph.stop();

0 commit comments

Comments
 (0)