Skip to content

Commit dcb85cc

Browse files
committed
tests: test fixes
1 parent 87df1c1 commit dcb85cc

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

src/config.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
import type { Host, Port } from './network/types';
2+
import type { NodeAddress } from 'nodes/types';
23
import { getDefaultNodePath } from './utils';
34
// @ts-ignore package.json is outside rootDir
45
import { version } from '../package.json';
56

7+
/**
8+
* Configuration for testnet node addresses.
9+
* Extracted here to enforce types properly.
10+
*/
11+
const testnet: Record<string, NodeAddress> = {
12+
vg9a9e957878s2qgtbdmu2atvli8ms7muukb1dk4dpbm4llkki3h0: {
13+
host: 'testnet.polykey.io' as Host,
14+
port: 1314 as Port,
15+
},
16+
vh9oqtvct10eaiv3cl4ebm0ko33sl0qqpvb59vud8cngfvqs4p4ng: {
17+
host: 'testnet.polykey.io' as Host,
18+
port: 1314 as Port,
19+
},
20+
};
21+
22+
/**
23+
* Configuration for main net node addresses.
24+
* Extracted here to enforce types properly.
25+
*/
26+
const mainnet: Record<string, NodeAddress> = {};
27+
628
/**
729
* Polykey static configuration
830
* This is intended only for static properties
@@ -96,17 +118,8 @@ const config = {
96118
},
97119
// This is not used by the `PolykeyAgent` which defaults to `{}`
98120
network: {
99-
mainnet: {},
100-
testnet: {
101-
vg9a9e957878s2qgtbdmu2atvli8ms7muukb1dk4dpbm4llkki3h0: {
102-
host: 'testnet.polykey.io' as Host,
103-
port: 1314 as Port,
104-
},
105-
vh9oqtvct10eaiv3cl4ebm0ko33sl0qqpvb59vud8cngfvqs4p4ng: {
106-
host: 'testnet.polykey.io' as Host,
107-
port: 1314 as Port,
108-
},
109-
},
121+
mainnet: mainnet,
122+
testnet: testnet,
110123
},
111124
},
112125
};

src/nodes/NodeConnectionManager.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,7 @@ class NodeConnectionManager {
829829
this.keyManager.getNodeId().equals(targetNodeId)
830830
) {
831831
// Logging and silently dropping operation
832-
this.logger.warn(
833-
'Attempted to send signaling message to our own NodeId',
834-
);
832+
this.logger.warn('Attempted to send signaling message to our own NodeId');
835833
return;
836834
}
837835
const rlyNode = nodesUtils.encodeNodeId(relayNodeId);

tests/bin/agent/start.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ describe('start', () => {
517517
// This line is brittle
518518
// It may change if the log format changes
519519
// Make sure to keep it updated at the exact point when the DB is created
520-
if (l === 'INFO:DB:Created DB') {
520+
if (l === 'INFO:polykey.PolykeyAgent.DB:Created DB') {
521521
agentProcess1.kill('SIGINT');
522522
resolve();
523523
}

tests/bin/bootstrap.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ describe('bootstrap', () => {
279279
// This line is brittle
280280
// It may change if the log format changes
281281
// Make sure to keep it updated at the exact point when the root key pair is generated
282-
if (l === 'INFO:KeyManager:Generating root key pair') {
282+
if (l === 'INFO:polykey.KeyManager:Generating root key pair') {
283283
bootstrapProcess1.kill('SIGINT');
284284
resolve();
285285
}

tests/bin/polykey.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('polykey', () => {
6464
const stderrParsed = JSON.parse(stderrStart);
6565
expect(stderrParsed).toMatchObject({
6666
level: expect.stringMatching(/INFO|WARN|ERROR|DEBUG/),
67-
key: expect.any(String),
67+
keys: expect.any(String),
6868
msg: expect.any(String),
6969
});
7070
agentProcess.kill('SIGTERM');

0 commit comments

Comments
 (0)