probing 3.0.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Versions
2
2
 
3
+ ## Version 5.0.0
4
+
5
+ - Node.js 18 or higher is now required
6
+
7
+ ## Version 4.0.0
8
+
9
+ - Node.js 16 or higher is now required
10
+
3
11
  ## Version 3.0.1
4
12
 
5
13
  - Node.js 14 or higher is now required
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Alex Bosworth
3
+ Copyright (c) 2020-2024 Alex Bosworth
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -7,17 +7,14 @@
7
7
  "url": "https://github.com/alexbosworth/probing/issues"
8
8
  },
9
9
  "dependencies": {
10
- "async": "3.2.4",
11
- "asyncjs-util": "1.2.11",
12
- "bolt07": "1.8.3",
13
- "ln-service": "54.9.0"
10
+ "async": "3.2.5",
11
+ "asyncjs-util": "1.2.12",
12
+ "bolt07": "1.8.4",
13
+ "ln-service": "57.8.1"
14
14
  },
15
15
  "description": "Lightning Network probing utilities",
16
- "devDependencies": {
17
- "@alexbosworth/tap": "15.0.12"
18
- },
19
16
  "engines": {
20
- "node": ">=14"
17
+ "node": ">=18"
21
18
  },
22
19
  "keywords": [
23
20
  "lightning",
@@ -32,7 +29,7 @@
32
29
  "url": "https://github.com/alexbosworth/probing.git"
33
30
  },
34
31
  "scripts": {
35
- "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 test/graph/*.js test/liquidity/*.js test/payments/*.js test/routing/*.js"
32
+ "test": "npx nyc@15.1 node --experimental-test-coverage --test"
36
33
  },
37
- "version": "3.0.1"
34
+ "version": "5.0.0"
38
35
  }
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {rejects} = require('node:assert').strict;
2
+ const strictSame = require('node:assert').strict.deepStrictEqual;
3
+ const test = require('node:test');
2
4
 
3
5
  const {channels} = require('./../fixtures/hop_hints');
4
6
  const {getPoliciesForChannels} = require('./../../graph');
@@ -182,7 +184,7 @@ const tests = [
182
184
  ];
183
185
 
184
186
  tests.forEach(({args, description, error, expected}) => {
185
- return test(description, async ({end, rejects, strictSame}) => {
187
+ return test(description, async () => {
186
188
  if (!!error) {
187
189
  await rejects(getPoliciesForChannels(args), error, 'Got expected error');
188
190
  } else {
@@ -191,6 +193,6 @@ tests.forEach(({args, description, error, expected}) => {
191
193
  strictSame(channels, expected.channels, 'Got expected channels');
192
194
  }
193
195
 
194
- return end();
196
+ return;
195
197
  });
196
198
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const strictSame = require('node:assert').strict.deepStrictEqual;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const {maxHtlcAcrossRoute} = require('./../../graph');
4
6
 
@@ -73,7 +75,7 @@ const tests = [
73
75
  ];
74
76
 
75
77
  tests.forEach(({args, description, error, expected}) => {
76
- return test(description, async ({end, strictSame, throws}) => {
78
+ return test(description, (t, end) => {
77
79
  if (!!error) {
78
80
  throws(() => maxHtlcAcrossRoute(args), error, 'Got expected error');
79
81
  } else {
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {rejects} = require('node:assert').strict;
2
+ const strictSame = require('node:assert').strict.deepStrictEqual;
3
+ const test = require('node:test');
2
4
 
3
5
  const findMaxPayable = require('./../../liquidity/find_max_payable');
4
6
  const {getInfoResponse} = require('./../fixtures');
@@ -208,19 +210,19 @@ const tests = [
208
210
  ];
209
211
 
210
212
  tests.forEach(({args, description, error, expected}) => {
211
- return test(description, async ({end, equal, rejects}) => {
213
+ return test(description, async () => {
212
214
  if (!!error) {
213
215
  await rejects(findMaxPayable(args), error, 'Got expected error');
214
216
  } else if (expected.maximum) {
215
217
  const {maximum} = await findMaxPayable(args);
216
218
 
217
- equal(maximum > expected.maximum - 100000, true, 'Got expected maximum');
219
+ strictSame(maximum > expected.maximum - 100000, true, 'Got maximum');
218
220
  } else {
219
221
  const {maximum} = await findMaxPayable(args);
220
222
 
221
- equal(maximum, Number(), 'Max payable is zero');
223
+ strictSame(maximum, Number(), 'Max payable is zero');
222
224
  }
223
225
 
224
- return end();
226
+ return;
225
227
  });
226
228
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {rejects} = require('node:assert').strict;
2
+ const strictSame = require('node:assert').strict.deepStrictEqual;
3
+ const test = require('node:test');
2
4
 
3
5
  const {getInfoResponse} = require('./../fixtures');
4
6
  const {getSyntheticOutIgnores} = require('./../../');
@@ -100,7 +102,7 @@ const tests = [
100
102
  ];
101
103
 
102
104
  tests.forEach(({args, description, error, expected}) => {
103
- return test(description, async ({end, rejects, strictSame}) => {
105
+ return test(description, async () => {
104
106
  if (!!error) {
105
107
  await rejects(getSyntheticOutIgnores(args), error, 'Got expected error');
106
108
  } else {
@@ -109,6 +111,6 @@ tests.forEach(({args, description, error, expected}) => {
109
111
  strictSame(ignore, expected.ignore, 'Got expected ignores');
110
112
  }
111
113
 
112
- return end();
114
+ return;
113
115
  });
114
116
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const strictSame = require('node:assert').strict.deepStrictEqual;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const hopsForFindMaxPath = require('./../../liquidity/hops_for_find_max_path');
4
6
 
@@ -94,7 +96,7 @@ const tests = [
94
96
  ];
95
97
 
96
98
  tests.forEach(({args, description, error, expected}) => {
97
- return test(description, async ({end, strictSame, throws}) => {
99
+ return test(description, (t, end) => {
98
100
  if (!!error) {
99
101
  throws(() => hopsForFindMaxPath(args), new Error(error), 'Got error');
100
102
  } else {
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const strictSame = require('node:assert').strict.deepStrictEqual;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const multiProbeIgnores = require('./../../liquidity/multi_probe_ignores');
4
6
 
@@ -265,7 +267,7 @@ const tests = [
265
267
  ];
266
268
 
267
269
  tests.forEach(({args, description, error, expected}) => {
268
- return test(description, async ({end, strictSame, throws}) => {
270
+ return test(description, (t, end) => {
269
271
  if (!!error) {
270
272
  throws(() => multiProbeIgnores(args), new Error(error), 'Got error');
271
273
  } else {
@@ -1,7 +1,8 @@
1
1
  const {once} = require('events');
2
2
  const {promisify} = require('util');
3
-
4
- const {test} = require('@alexbosworth/tap');
3
+ const strictSame = require('node:assert').strict.deepStrictEqual;
4
+ const test = require('node:test');
5
+ const {throws} = require('node:assert').strict;
5
6
 
6
7
  const {getChanInfoResponse} = require('./../fixtures');
7
8
  const {getInfoResponse} = require('./../fixtures');
@@ -77,7 +78,7 @@ const tests = [
77
78
  ];
78
79
 
79
80
  tests.forEach(({args, description, error, expected}) => {
80
- return test(description, async ({end, strictSame, throws}) => {
81
+ return test(description, async () => {
81
82
  if (!!error) {
82
83
  throws(() => subscribeToFindMaxPayable(args), error, 'Got error');
83
84
  } else {
@@ -102,6 +103,6 @@ tests.forEach(({args, description, error, expected}) => {
102
103
  strictSame(events, expected.events, 'Got expected events');
103
104
  }
104
105
 
105
- return end();
106
+ return;
106
107
  });
107
108
  });
@@ -1,7 +1,8 @@
1
1
  const {once} = require('events');
2
2
  const {promisify} = require('util');
3
-
4
- const {test} = require('@alexbosworth/tap');
3
+ const strictSame = require('node:assert').strict.deepStrictEqual;
4
+ const test = require('node:test');
5
+ const {throws} = require('node:assert').strict;
5
6
 
6
7
  const {getChanInfoResponse} = require('./../fixtures');
7
8
  const {getInfoResponse} = require('./../fixtures');
@@ -451,7 +452,7 @@ const tests = [
451
452
  ];
452
453
 
453
454
  tests.forEach(({args, description, error, expected}) => {
454
- return test(description, async ({end, strictSame, throws}) => {
455
+ return test(description, async () => {
455
456
  if (!!error) {
456
457
  throws(() => method(args), error, 'Got error');
457
458
  } else {
@@ -478,7 +479,5 @@ tests.forEach(({args, description, error, expected}) => {
478
479
 
479
480
  strictSame(events, expected.events, 'Got expected events');
480
481
  }
481
-
482
- return end();
483
482
  });
484
483
  });
@@ -1,7 +1,8 @@
1
1
  const {once} = require('events');
2
2
  const {promisify} = require('util');
3
-
4
- const {test} = require('@alexbosworth/tap');
3
+ const strictSame = require('node:assert').strict.deepStrictEqual;
4
+ const test = require('node:test');
5
+ const {throws} = require('node:assert').strict;
5
6
 
6
7
  const {getChanInfoResponse} = require('./../fixtures');
7
8
  const {getInfoResponse} = require('./../fixtures');
@@ -325,7 +326,7 @@ const tests = [
325
326
  ];
326
327
 
327
328
  tests.forEach(({args, description, error, expected}) => {
328
- return test(description, async ({end, strictSame, throws}) => {
329
+ return test(description, async () => {
329
330
  if (!!error) {
330
331
  throws(() => subscribeToMultiPathProbe(args), error, 'Got error');
331
332
  } else {
@@ -353,6 +354,6 @@ tests.forEach(({args, description, error, expected}) => {
353
354
  strictSame(events, expected.events, 'Got expected events');
354
355
  }
355
356
 
356
- return end();
357
+ return;
357
358
  });
358
359
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {rejects} = require('node:assert').strict;
2
+ const strictSame = require('node:assert').strict.deepStrictEqual;
3
+ const test = require('node:test');
2
4
 
3
5
  const {getChanInfoResponse} = require('./../fixtures');
4
6
  const {getInfoResponse} = require('./../fixtures');
@@ -158,7 +160,7 @@ const tests = [
158
160
  ];
159
161
 
160
162
  tests.forEach(({args, description, error, expected}) => {
161
- return test(description, async ({end, rejects, strictSame}) => {
163
+ return test(description, async () => {
162
164
  if (!!error) {
163
165
  await rejects(getRouteForPayment(args), error, 'Got expected error');
164
166
  } else {
@@ -167,6 +169,6 @@ tests.forEach(({args, description, error, expected}) => {
167
169
  strictSame(route, expected, 'Got expected route');
168
170
  }
169
171
 
170
- return end();
172
+ return;
171
173
  });
172
174
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const strictSame = require('node:assert').strict.deepStrictEqual;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const method = require('./../../payments/mtokens_for_multi_path_payment');
4
6
 
@@ -59,13 +61,13 @@ const tests = [
59
61
  ];
60
62
 
61
63
  tests.forEach(({args, description, error, expected}) => {
62
- return test(description, async ({end, strictSame, throws}) => {
64
+ return test(description, (t, end) => {
63
65
  if (!!error) {
64
66
  throws(() => method(args), error, 'Got expected error');
65
67
  } else {
66
68
  const {sorted} = method(args);
67
69
 
68
- strictSame(sorted, expected.sorted);
70
+ strictSame(sorted, expected.sorted, 'Got expected result');
69
71
  }
70
72
 
71
73
  return end();
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const strictSame = require('node:assert').strict.deepStrictEqual;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const method = require('./../../payments/sort_multiple_payment_paths');
4
6
 
@@ -75,7 +77,7 @@ const tests = [
75
77
  ];
76
78
 
77
79
  tests.forEach(({args, description, error, expected}) => {
78
- return test(description, async ({end, strictSame, throws}) => {
80
+ return test(description, (t, end) => {
79
81
  if (!!error) {
80
82
  throws(() => method(args), error, 'Got expected error');
81
83
  } else {
@@ -1,7 +1,8 @@
1
1
  const {once} = require('events');
2
2
  const {promisify} = require('util');
3
-
4
- const {test} = require('@alexbosworth/tap');
3
+ const strictSame = require('node:assert').strict.deepStrictEqual;
4
+ const test = require('node:test');
5
+ const {throws} = require('node:assert').strict;
5
6
 
6
7
  const {getChanInfoResponse} = require('./../fixtures');
7
8
  const {getInfoResponse} = require('./../fixtures');
@@ -895,7 +896,7 @@ const tests = [
895
896
  ];
896
897
 
897
898
  tests.forEach(({args, description, error, expected}) => {
898
- return test(description, async ({end, strictSame, throws}) => {
899
+ return test(description, async () => {
899
900
  if (!!error) {
900
901
  throws(() => subscribeToMultiPathPay(args), error, 'Got error');
901
902
  } else {
@@ -916,7 +917,7 @@ tests.forEach(({args, description, error, expected}) => {
916
917
 
917
918
  await nextTick();
918
919
 
919
- await delay(50)
920
+ await delay(50);
920
921
 
921
922
  // Make sure that no listener to error doesn't cause an issue
922
923
  const sub2 = subscribeToMultiPathPay(args);
@@ -926,6 +927,6 @@ tests.forEach(({args, description, error, expected}) => {
926
927
  strictSame(events, expected.events, 'Got expected events');
927
928
  }
928
929
 
929
- return end();
930
+ return;
930
931
  });
931
932
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const strictSame = require('node:assert').strict.deepStrictEqual;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const {channels} = require('./../fixtures/hop_hints');
4
6
  const {channelsFromHints} = require('./../../routing');
@@ -37,7 +39,7 @@ const tests = [
37
39
  ];
38
40
 
39
41
  tests.forEach(({args, description, error, expected}) => {
40
- return test(description, async ({end, strictSame, throws}) => {
42
+ return test(description, (t, end) => {
41
43
  if (!!error) {
42
44
  throws(() => findMaxPayable(args), error, 'Got expected error');
43
45
  } else {
@@ -1,7 +1,8 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {rejects} = require('node:assert').strict;
2
+ const strictSame = require('node:assert').strict.deepStrictEqual;
3
+ const test = require('node:test');
2
4
 
3
5
  const {getInfoResponse} = require('./../fixtures');
4
-
5
6
  const isRoutePayable = require('./../../routing/is_route_payable');
6
7
 
7
8
  const getInfoRes = () => JSON.parse(JSON.stringify(getInfoResponse));
@@ -206,15 +207,15 @@ const tests = [
206
207
  ];
207
208
 
208
209
  tests.forEach(({args, description, error, expected}) => {
209
- return test(description, async ({end, equal, rejects}) => {
210
+ return test(description, async () => {
210
211
  if (!!error) {
211
- rejects(isRoutePayable(args), error, 'Got expected error');
212
+ await rejects(isRoutePayable(args), error, 'Got expected error');
212
213
  } else {
213
214
  const payable = await isRoutePayable(args);
214
215
 
215
- equal(payable.is_payable, expected.is_payable, 'Got is_payable');
216
+ strictSame(payable.is_payable, expected.is_payable, 'Got is_payable');
216
217
  }
217
218
 
218
- return end();
219
+ return;
219
220
  });
220
221
  });