paid-services 7.0.2 → 8.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/package.json +9 -11
  3. package/test/actions/test_execute_email_action.js +13 -6
  4. package/test/actions/test_execute_inbox_action.js +14 -6
  5. package/test/actions/test_execute_sms_action.js +14 -7
  6. package/test/actions/test_inbox_action_arguments.js +14 -6
  7. package/test/actions/test_send_postmark_email.js +13 -6
  8. package/test/actions/test_send_twilio_sms.js +13 -6
  9. package/test/balanced/test_balanced_open_request.js +13 -6
  10. package/test/capacity/test_assemble_replacement_tx.js +13 -6
  11. package/test/capacity/test_capacity_change_requests.js +13 -6
  12. package/test/capacity/test_encode_change_request.js +13 -6
  13. package/test/capacity/test_encode_sign_capacity_response.js +13 -6
  14. package/test/capacity/test_fee_for_replacement.js +13 -6
  15. package/test/capacity/test_finalize_capacity_replacement.js +13 -6
  16. package/test/capacity/test_interim_replacement_psbt.js +13 -6
  17. package/test/capacity/test_is_open_witness_script.js +13 -6
  18. package/test/capacity/test_parse_accept_request.js +13 -6
  19. package/test/capacity/test_parse_capacity_change_request.js +13 -6
  20. package/test/capacity/test_parse_sign_capacity_request.js +6 -11
  21. package/test/capacity/test_witness_script_from_close_txs.js +6 -11
  22. package/test/client/test_arguments_for_schema.js +13 -6
  23. package/test/client/test_byte_limited_string.js +14 -7
  24. package/test/client/test_confirm_service_use.js +14 -6
  25. package/test/client/test_decode_nodes_record.js +13 -6
  26. package/test/client/test_decode_schema_fields.js +14 -7
  27. package/test/client/test_decode_schema_records.js +13 -6
  28. package/test/client/test_decode_urls_record.js +14 -6
  29. package/test/client/test_error_records_as_error.js +14 -6
  30. package/test/client/test_make_service_request.js +14 -6
  31. package/test/client/test_messages_as_response.js +14 -6
  32. package/test/client/test_messages_for_request.js +14 -6
  33. package/test/client/test_wait_for_response.js +14 -6
  34. package/test/config/test_is_activity_enabled.js +13 -6
  35. package/test/config/test_is_connect_enabled.js +13 -6
  36. package/test/config/test_is_email_configured.js +13 -6
  37. package/test/config/test_is_invoice_enabled.js +13 -6
  38. package/test/config/test_is_sms_configured.js +13 -6
  39. package/test/config/test_validate_server_config.js +13 -6
  40. package/test/integration/test_accept_capacity_change.js +7 -9
  41. package/test/integration/test_change_channel_capacity.js +5 -5
  42. package/test/integration/test_decrease_channel_capacity.js +5 -5
  43. package/test/integration/test_fanout.js +21 -19
  44. package/test/integration/test_group.js +12 -12
  45. package/test/integration/test_group_noninteractive.js +5 -8
  46. package/test/integration/test_group_pair.js +10 -10
  47. package/test/integration/test_group_sort.js +16 -17
  48. package/test/integration/test_increase_channel_capacity.js +5 -5
  49. package/test/integration/test_move_channel_capacity.js +5 -5
  50. package/test/integration/test_request_swap_out.js +7 -7
  51. package/test/integration/test_service_peer_requests.js +8 -7
  52. package/test/integration/test_sign_capacity_replacement.js +6 -6
  53. package/test/integration/test_split_channel_capacity.js +5 -5
  54. package/test/integration/test_swap_with_claim_path.js +7 -7
  55. package/test/integration/test_swap_with_refund_path.js +10 -9
  56. package/test/integration.js +18 -0
  57. package/test/p2p/test_encode_peer_request.js +13 -6
  58. package/test/p2p/test_encode_peer_response.js +6 -11
  59. package/test/p2p/test_encode_response_code.js +13 -6
  60. package/test/records/test_request_as_request_records.js +13 -6
  61. package/test/records/test_request_records_as_request.js +14 -6
  62. package/test/respond/test_error_as_error_records.js +13 -6
  63. package/test/respond/test_messages_for_response.js +13 -6
  64. package/test/respond/test_send_service_response.js +93 -81
  65. package/test/respond/test_urls_as_urls_record.js +13 -6
  66. package/test/server/test_get_service_request.js +14 -8
  67. package/test/server/test_invoice_as_request.js +13 -6
  68. package/test/server/test_paid_service_event.js +169 -161
  69. package/test/server/test_process_paywall.js +99 -93
  70. package/test/server/test_process_request.js +138 -126
  71. package/test/services/test_is_service_enabled.js +5 -6
  72. package/test/services/test_registered_services.js +5 -6
  73. package/test/services/test_respond_to_request.js +13 -6
  74. package/test/services/test_response_for_activity.js +14 -6
  75. package/test/services/test_response_for_inbox.js +14 -6
  76. package/test/services/test_response_for_network.js +13 -6
  77. package/test/services/test_response_for_pong.js +6 -11
  78. package/test/services/test_response_for_profile.js +13 -6
  79. package/test/services/test_response_for_schema.js +14 -6
  80. package/test/services/test_response_for_services.js +13 -6
  81. package/test/swaps/test_decode_loop_response.js +13 -6
  82. package/test/trades/test_decode_basic_trade.js +13 -6
  83. package/test/trades/test_decode_open_trade.js +13 -6
  84. package/test/trades/test_encode_open_trade.js +13 -6
  85. package/test/trades/test_encode_trade.js +13 -6
package/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Versions
2
2
 
3
- ## Version 7.0.2
3
+ ## Version 8.0.0
4
+
5
+ ### Breaking Changes
6
+
7
+ - node.js 20 is no longer supported, node.js 22+ required
8
+
9
+ ## Version 7.0.3
4
10
 
5
11
  ### Breaking Changes
6
12
 
package/package.json CHANGED
@@ -15,23 +15,21 @@
15
15
  "bolt01": "3.0.0",
16
16
  "bolt07": "1.9.5",
17
17
  "ecpair": "2.1.0",
18
- "goldengate": "15.0.0",
18
+ "goldengate": "16.0.0",
19
19
  "invoices": "5.0.2",
20
- "ln-service": "58.0.2",
21
- "ln-sync": "7.0.0",
20
+ "ln-service": "59.0.0",
21
+ "ln-sync": "8.0.0",
22
22
  "psbt": "5.0.0",
23
23
  "p2tr": "2.0.0",
24
24
  "tiny-secp256k1": "2.2.4"
25
25
  },
26
26
  "description": "Lightning Paid Services library",
27
27
  "devDependencies": {
28
- "@alexbosworth/tap": "15.0.12",
29
- "ln-docker-daemons": "7.0.0",
30
- "mock-lnd": "2.0.0",
31
- "secp256k1": "5.0.1"
28
+ "ln-docker-daemons": "8.0.0",
29
+ "mock-lnd": "4.0.0"
32
30
  },
33
31
  "engines": {
34
- "node": ">=20"
32
+ "node": ">=22"
35
33
  },
36
34
  "keywords": [
37
35
  "lightning",
@@ -45,8 +43,8 @@
45
43
  "url": "https://github.com/alexbosworth/paid-services.git"
46
44
  },
47
45
  "scripts": {
48
- "integration-tests": "tap -j 1 --branches=1 --functions=1 --lines=1 --statements=1 -t 2700 test/integration/*.js",
49
- "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 -t 60 test/actions/*.js test/balanced/*.js test/capacity/*.js test/client/*.js test/config/*.js test/p2p/*.js test/records/*.js test/respond/*.js test/server/*.js test/swaps/*.js test/services/*.js test/trades/*.js"
46
+ "integration-tests": "node test/integration",
47
+ "test": "npx nyc@17.1.0 node --experimental-test-coverage --test test/actions/*.js test/balanced/*.js test/capacity/*.js test/client/*.js test/config/*.js test/p2p/*.js test/records/*.js test/respond/*.js test/server/*.js test/swaps/*.js test/services/*.js test/trades/*.js"
50
48
  },
51
- "version": "7.0.2"
49
+ "version": "8.0.0"
52
50
  }
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, rejects} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../actions/execute_email_action');
4
5
 
@@ -50,15 +51,21 @@ const tests = [
50
51
  ];
51
52
 
52
53
  tests.forEach(({args, description, error, expected}) => {
53
- return test(description, async ({end, strictSame, rejects}) => {
54
+ test(description, async () => {
54
55
  if (!!error) {
55
- await rejects(method(args), error, 'Got error');
56
+ await rejects(
57
+ method(args),
58
+ err => {
59
+ deepStrictEqual(err, error, 'Got error');
60
+
61
+ return true;
62
+ },
63
+ 'Got error'
64
+ );
56
65
  } else {
57
66
  const res = await method(args);
58
67
 
59
- strictSame(res, expected, 'Got expected result');
68
+ deepStrictEqual(res, expected, 'Got expected result');
60
69
  }
61
-
62
- return end();
63
70
  });
64
71
  });
@@ -1,5 +1,7 @@
1
+ const {deepStrictEqual, rejects} = require('node:assert/strict');
2
+ const {test} = require('node:test');
3
+
1
4
  const {encodeTlvStream} = require('bolt01');
2
- const {test} = require('@alexbosworth/tap');
3
5
 
4
6
  const method = require('./../../actions/execute_inbox_action');
5
7
 
@@ -58,15 +60,21 @@ const tests = [
58
60
  ];
59
61
 
60
62
  tests.forEach(({args, description, error, expected}) => {
61
- return test(description, async ({end, strictSame, rejects}) => {
63
+ test(description, async () => {
62
64
  if (!!error) {
63
- await rejects(method(args), error, 'Got error');
65
+ await rejects(
66
+ method(args),
67
+ err => {
68
+ deepStrictEqual(err, error, 'Got error');
69
+
70
+ return true;
71
+ },
72
+ 'Got error'
73
+ );
64
74
  } else {
65
75
  const res = await method(args);
66
76
 
67
- strictSame(res, expected, 'Got expected result');
77
+ deepStrictEqual(res, expected, 'Got expected result');
68
78
  }
69
-
70
- return end();
71
79
  });
72
80
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, rejects} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../actions/execute_sms_action');
4
5
 
@@ -51,15 +52,21 @@ const tests = [
51
52
  ];
52
53
 
53
54
  tests.forEach(({args, description, error, expected}) => {
54
- return test(description, async ({end, strictSame, rejects}) => {
55
+ test(description, async () => {
55
56
  if (!!error) {
56
- await rejects(method(args), error, 'Got error');
57
+ await rejects(
58
+ method(args),
59
+ err => {
60
+ deepStrictEqual(err, error, 'Got error');
61
+
62
+ return true;
63
+ },
64
+ 'Got error'
65
+ );
57
66
  } else {
58
67
  const res = await method(args);
59
68
 
60
- strictSame(res, expected, 'Got expected result');
69
+ deepStrictEqual(res, expected, 'Got expected result');
61
70
  }
62
-
63
- return end();
64
71
  });
65
- });
72
+ });
@@ -1,5 +1,7 @@
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
3
+
1
4
  const {encodeTlvStream} = require('bolt01');
2
- const {test} = require('@alexbosworth/tap');
3
5
 
4
6
  const method = require('./../../actions/inbox_action_arguments');
5
7
 
@@ -61,15 +63,21 @@ const tests = [
61
63
  ];
62
64
 
63
65
  tests.forEach(({args, description, error, expected}) => {
64
- return test(description, async ({end, strictSame, throws}) => {
66
+ test(description, () => {
65
67
  if (!!error) {
66
- throws(() => method(args), new Error(error), 'Got error');
68
+ throws(
69
+ () => method(args),
70
+ err => {
71
+ strictEqual(err.message, error, 'Got error');
72
+
73
+ return true;
74
+ },
75
+ 'Got error'
76
+ );
67
77
  } else {
68
78
  const res = method(args);
69
79
 
70
- strictSame(res, expected, 'Got expected result');
80
+ deepStrictEqual(res, expected, 'Got expected result');
71
81
  }
72
-
73
- return end();
74
82
  });
75
83
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, rejects} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../actions/send_postmark_email');
4
5
 
@@ -60,15 +61,21 @@ const tests = [
60
61
  ];
61
62
 
62
63
  tests.forEach(({args, description, error, expected}) => {
63
- return test(description, async ({end, strictSame, rejects}) => {
64
+ test(description, async () => {
64
65
  if (!!error) {
65
- await rejects(method(args), error, 'Got error');
66
+ await rejects(
67
+ method(args),
68
+ err => {
69
+ deepStrictEqual(err, error, 'Got error');
70
+
71
+ return true;
72
+ },
73
+ 'Got error'
74
+ );
66
75
  } else {
67
76
  const res = await method(args);
68
77
 
69
- strictSame(res, expected, 'Got expected result');
78
+ deepStrictEqual(res, expected, 'Got expected result');
70
79
  }
71
-
72
- return end();
73
80
  });
74
81
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, rejects} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../actions/send_twilio_sms');
4
5
 
@@ -67,15 +68,21 @@ const tests = [
67
68
  ];
68
69
 
69
70
  tests.forEach(({args, description, error, expected}) => {
70
- return test(description, async ({end, strictSame, rejects}) => {
71
+ test(description, async () => {
71
72
  if (!!error) {
72
- await rejects(method(args), error, 'Got error');
73
+ await rejects(
74
+ method(args),
75
+ err => {
76
+ deepStrictEqual(err, error, 'Got error');
77
+
78
+ return true;
79
+ },
80
+ 'Got error'
81
+ );
73
82
  } else {
74
83
  const res = await method(args);
75
84
 
76
- strictSame(res, expected, 'Got expected result');
85
+ deepStrictEqual(res, expected, 'Got expected result');
77
86
  }
78
-
79
- return end();
80
87
  });
81
88
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../balanced/balanced_open_request');
4
5
 
@@ -164,15 +165,21 @@ const tests = [
164
165
  ];
165
166
 
166
167
  tests.forEach(({args, description, error, expected}) => {
167
- return test(description, async ({end, strictSame, throws}) => {
168
+ test(description, () => {
168
169
  if (!!error) {
169
- throws(() => method(args), new Error(error), 'Got error');
170
+ throws(
171
+ () => method(args),
172
+ err => {
173
+ strictEqual(err.message, error, 'Got error');
174
+
175
+ return true;
176
+ },
177
+ 'Got error'
178
+ );
170
179
  } else {
171
180
  const res = method(args);
172
181
 
173
- strictSame(res, expected, 'Got expected result');
182
+ deepStrictEqual(res, expected, 'Got expected result');
174
183
  }
175
-
176
- return end();
177
184
  });
178
185
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/assemble_replacement_tx');
4
5
 
@@ -32,15 +33,21 @@ const tests = [
32
33
  ];
33
34
 
34
35
  tests.forEach(({args, description, error, expected}) => {
35
- return test(description, async ({end, strictSame, throws}) => {
36
+ test(description, () => {
36
37
  if (!!error) {
37
- throws(() => method(args), new Error(error), 'Got error');
38
+ throws(
39
+ () => method(args),
40
+ err => {
41
+ strictEqual(err.message, error, 'Got error');
42
+
43
+ return true;
44
+ },
45
+ 'Got error'
46
+ );
38
47
  } else {
39
48
  const res = method(args);
40
49
 
41
- strictSame(res, expected, 'Got expected result');
50
+ deepStrictEqual(res, expected, 'Got expected result');
42
51
  }
43
-
44
- return end();
45
52
  });
46
53
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/capacity_change_requests');
4
5
 
@@ -42,15 +43,21 @@ const tests = [
42
43
  ];
43
44
 
44
45
  tests.forEach(({args, description, error, expected}) => {
45
- return test(description, async ({end, strictSame, throws}) => {
46
+ test(description, () => {
46
47
  if (!!error) {
47
- throws(() => method(args), new Error(error), 'Got error');
48
+ throws(
49
+ () => method(args),
50
+ err => {
51
+ strictEqual(err.message, error, 'Got error');
52
+
53
+ return true;
54
+ },
55
+ 'Got error'
56
+ );
48
57
  } else {
49
58
  const res = method(args);
50
59
 
51
- strictSame(res, expected, 'Got expected result');
60
+ deepStrictEqual(res, expected, 'Got expected result');
52
61
  }
53
-
54
- return end();
55
62
  });
56
63
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/encode_change_request');
4
5
 
@@ -44,15 +45,21 @@ const tests = [
44
45
  ];
45
46
 
46
47
  tests.forEach(({args, description, error, expected}) => {
47
- return test(description, async ({end, strictSame, throws}) => {
48
+ test(description, () => {
48
49
  if (!!error) {
49
- throws(() => method(args), new Error(error), 'Got error');
50
+ throws(
51
+ () => method(args),
52
+ err => {
53
+ strictEqual(err.message, error, 'Got error');
54
+
55
+ return true;
56
+ },
57
+ 'Got error'
58
+ );
50
59
  } else {
51
60
  const res = method(args);
52
61
 
53
- strictSame(res, expected, 'Got expected result');
62
+ deepStrictEqual(res, expected, 'Got expected result');
54
63
  }
55
-
56
- return end();
57
64
  });
58
65
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/encode_sign_capacity_response');
4
5
 
@@ -33,15 +34,21 @@ const tests = [
33
34
  ];
34
35
 
35
36
  tests.forEach(({args, description, error, expected}) => {
36
- return test(description, async ({end, strictSame, throws}) => {
37
+ test(description, () => {
37
38
  if (!!error) {
38
- throws(() => method(args), new Error(error), 'Got error');
39
+ throws(
40
+ () => method(args),
41
+ err => {
42
+ strictEqual(err.message, error, 'Got error');
43
+
44
+ return true;
45
+ },
46
+ 'Got error'
47
+ );
39
48
  } else {
40
49
  const res = method(args);
41
50
 
42
- strictSame(res, expected, 'Got expected result');
51
+ deepStrictEqual(res, expected, 'Got expected result');
43
52
  }
44
-
45
- return end();
46
53
  });
47
54
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/fee_for_replacement');
4
5
 
@@ -26,15 +27,21 @@ const tests = [
26
27
  ];
27
28
 
28
29
  tests.forEach(({args, description, error, expected}) => {
29
- return test(description, async ({end, strictSame, throws}) => {
30
+ test(description, () => {
30
31
  if (!!error) {
31
- throws(() => method(args), new Error(error), 'Got error');
32
+ throws(
33
+ () => method(args),
34
+ err => {
35
+ strictEqual(err.message, error, 'Got error');
36
+
37
+ return true;
38
+ },
39
+ 'Got error'
40
+ );
32
41
  } else {
33
42
  const res = method(args);
34
43
 
35
- strictSame(res, expected, 'Got expected result');
44
+ deepStrictEqual(res, expected, 'Got expected result');
36
45
  }
37
-
38
- return end();
39
46
  });
40
47
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/finalize_capacity_replacement');
4
5
 
@@ -31,15 +32,21 @@ const tests = [
31
32
  ];
32
33
 
33
34
  tests.forEach(({args, description, error, expected}) => {
34
- return test(description, async ({end, strictSame, throws}) => {
35
+ test(description, () => {
35
36
  if (!!error) {
36
- throws(() => method(args), new Error(error), 'Got error');
37
+ throws(
38
+ () => method(args),
39
+ err => {
40
+ strictEqual(err.message, error, 'Got error');
41
+
42
+ return true;
43
+ },
44
+ 'Got error'
45
+ );
37
46
  } else {
38
47
  const res = method(args);
39
48
 
40
- strictSame(res, expected, 'Got expected result');
49
+ deepStrictEqual(res, expected, 'Got expected result');
41
50
  }
42
-
43
- return end();
44
51
  });
45
52
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
  const tinysecp = require('tiny-secp256k1');
3
4
 
4
5
  const method = require('./../../capacity/interim_replacement_psbt');
@@ -31,17 +32,23 @@ const tests = [
31
32
  ];
32
33
 
33
34
  tests.forEach(({args, description, error, expected}) => {
34
- return test(description, async ({end, strictSame, throws}) => {
35
+ test(description, async () => {
35
36
  args.ecp = (await import('ecpair')).ECPairFactory(tinysecp);
36
37
 
37
38
  if (!!error) {
38
- throws(() => method(args), new Error(error), 'Got error');
39
+ throws(
40
+ () => method(args),
41
+ err => {
42
+ strictEqual(err.message, error, 'Got error');
43
+
44
+ return true;
45
+ },
46
+ 'Got error'
47
+ );
39
48
  } else {
40
49
  const res = method(args);
41
50
 
42
- strictSame(res, expected, 'Got expected result');
51
+ deepStrictEqual(res, expected, 'Got expected result');
43
52
  }
44
-
45
- return end();
46
53
  });
47
54
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/is_open_witness_script');
4
5
 
@@ -26,15 +27,21 @@ const tests = [
26
27
  ];
27
28
 
28
29
  tests.forEach(({args, description, error, expected}) => {
29
- return test(description, async ({end, strictSame, throws}) => {
30
+ test(description, () => {
30
31
  if (!!error) {
31
- throws(() => method(args), new Error(error), 'Got error');
32
+ throws(
33
+ () => method(args),
34
+ err => {
35
+ strictEqual(err.message, error, 'Got error');
36
+
37
+ return true;
38
+ },
39
+ 'Got error'
40
+ );
32
41
  } else {
33
42
  const res = method(args);
34
43
 
35
- strictSame(res, expected, 'Got expected result');
44
+ strictEqual(res, expected, 'Got expected result');
36
45
  }
37
-
38
- return end();
39
46
  });
40
47
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/parse_accept_request');
4
5
 
@@ -28,15 +29,21 @@ const tests = [
28
29
  ];
29
30
 
30
31
  tests.forEach(({args, description, error, expected}) => {
31
- return test(description, async ({end, strictSame, throws}) => {
32
+ test(description, () => {
32
33
  if (!!error) {
33
- throws(() => method(args), new Error(error), 'Got error');
34
+ throws(
35
+ () => method(args),
36
+ err => {
37
+ strictEqual(err.message, error, 'Got error');
38
+
39
+ return true;
40
+ },
41
+ 'Got error'
42
+ );
34
43
  } else {
35
44
  const res = method(args);
36
45
 
37
- strictSame(res, expected, 'Got expected result');
46
+ deepStrictEqual(res, expected, 'Got expected result');
38
47
  }
39
-
40
- return end();
41
48
  });
42
49
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual, strictEqual, throws} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/parse_capacity_change_request');
4
5
 
@@ -38,15 +39,21 @@ const tests = [
38
39
  ];
39
40
 
40
41
  tests.forEach(({args, description, error, expected}) => {
41
- return test(description, async ({end, strictSame, throws}) => {
42
+ test(description, () => {
42
43
  if (!!error) {
43
- throws(() => method(args), new Error(error), 'Got error');
44
+ throws(
45
+ () => method(args),
46
+ err => {
47
+ strictEqual(err.message, error, 'Got error');
48
+
49
+ return true;
50
+ },
51
+ 'Got error'
52
+ );
44
53
  } else {
45
54
  const res = method(args);
46
55
 
47
- strictSame(res, expected, 'Got expected result');
56
+ deepStrictEqual(res, expected, 'Got expected result');
48
57
  }
49
-
50
- return end();
51
58
  });
52
59
  });
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepStrictEqual} = require('node:assert/strict');
2
+ const {test} = require('node:test');
2
3
 
3
4
  const method = require('./../../capacity/parse_sign_capacity_request');
4
5
 
@@ -34,16 +35,10 @@ const tests = [
34
35
  },
35
36
  ];
36
37
 
37
- tests.forEach(({args, description, error, expected}) => {
38
- return test(description, async ({end, strictSame, throws}) => {
39
- if (!!error) {
40
- throws(() => method(args), new Error(error), 'Got error');
41
- } else {
42
- const res = method(args);
38
+ tests.forEach(({args, description, expected}) => {
39
+ test(description, () => {
40
+ const res = method(args);
43
41
 
44
- strictSame(res, expected, 'Got expected result');
45
- }
46
-
47
- return end();
42
+ deepStrictEqual(res, expected, 'Got expected result');
48
43
  });
49
44
  });