ln-accounting 7.0.1 → 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.
- package/CHANGELOG.md +7 -1
- package/package.json +9 -12
- package/test/blockstream/test_get_blockstream_tx.js +6 -4
- package/test/fiat/test_get_coincap_historic_rate.js +8 -6
- package/test/fiat/test_get_coindesk_historic_rate.js +8 -6
- package/test/fiat/test_get_coingecko_historic_rate.js +6 -4
- package/test/fiat/test_get_fiat_values.js +8 -6
- package/test/fiat/test_get_historic_rate.js +6 -4
- package/test/harmony/test_categorize_records.js +7 -4
- package/test/harmony/test_chain_fees_as_records.js +4 -3
- package/test/harmony/test_chain_receives_as_records.js +5 -3
- package/test/harmony/test_chain_sends_as_records.js +4 -3
- package/test/harmony/test_formatted_notes.js +4 -2
- package/test/harmony/test_forwards_as_records.js +5 -3
- package/test/harmony/test_harmonize.js +3 -2
- package/test/harmony/test_invoices_as_records.js +5 -3
- package/test/harmony/test_notes_for_chain_transaction.js +3 -2
- package/test/harmony/test_payments_as_records.js +4 -3
- package/test/harmony/test_records_with_fiat.js +7 -7
- package/test/records/test_get_all_invoices.js +6 -4
- package/test/records/test_get_all_payments.js +6 -4
- package/test/report/test_parse_amount.js +4 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -7,20 +7,17 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/ln-accounting/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@json2csv/plainjs": "
|
|
11
|
-
"async": "3.2.
|
|
12
|
-
"asyncjs-util": "1.2.
|
|
13
|
-
"bitcoinjs-lib": "6.1.
|
|
14
|
-
"goldengate": "
|
|
10
|
+
"@json2csv/plainjs": "7.0.6",
|
|
11
|
+
"async": "3.2.5",
|
|
12
|
+
"asyncjs-util": "1.2.12",
|
|
13
|
+
"bitcoinjs-lib": "6.1.5",
|
|
14
|
+
"goldengate": "14.0.2",
|
|
15
15
|
"hot-formula-parser": "4.0.0",
|
|
16
|
-
"ln-service": "
|
|
16
|
+
"ln-service": "57.8.1"
|
|
17
17
|
},
|
|
18
18
|
"description": "lnd accounting reports",
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@alexbosworth/tap": "15.0.12"
|
|
21
|
-
},
|
|
22
19
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
20
|
+
"node": ">=18"
|
|
24
21
|
},
|
|
25
22
|
"keywords": [
|
|
26
23
|
"accounting",
|
|
@@ -34,7 +31,7 @@
|
|
|
34
31
|
"url": "https://github.com/alexbosworth/ln-accounting.git"
|
|
35
32
|
},
|
|
36
33
|
"scripts": {
|
|
37
|
-
"test": "
|
|
34
|
+
"test": "npx nyc@15.1.0 node --experimental-test-coverage --test"
|
|
38
35
|
},
|
|
39
|
-
"version": "
|
|
36
|
+
"version": "8.0.0"
|
|
40
37
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const method = require('./../../blockstream/get_blockstream_tx');
|
|
4
6
|
|
|
@@ -95,15 +97,15 @@ const tests = [
|
|
|
95
97
|
];
|
|
96
98
|
|
|
97
99
|
tests.forEach(({args, description, error, expected}) => {
|
|
98
|
-
return test(description, async (
|
|
100
|
+
return test(description, async () => {
|
|
99
101
|
if (!!error) {
|
|
100
102
|
await rejects(method(args), error, 'Got expected error');
|
|
101
103
|
} else {
|
|
102
104
|
const res = await method(args);
|
|
103
105
|
|
|
104
|
-
|
|
106
|
+
deepEqual(res, expected, 'Got expected result');
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
return
|
|
109
|
+
return;
|
|
108
110
|
});
|
|
109
111
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {equal} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
|
-
const
|
|
5
|
+
const method = require('./../../fiat/get_coincap_historic_rate');
|
|
4
6
|
|
|
5
7
|
const date = new Date().toISOString();
|
|
6
8
|
|
|
@@ -70,15 +72,15 @@ const tests = [
|
|
|
70
72
|
];
|
|
71
73
|
|
|
72
74
|
tests.forEach(({args, description, error, expected}) => {
|
|
73
|
-
return test(description, async (
|
|
75
|
+
return test(description, async () => {
|
|
74
76
|
if (!!error) {
|
|
75
|
-
rejects(
|
|
77
|
+
await rejects(method(args), error, 'Got expected error');
|
|
76
78
|
} else {
|
|
77
|
-
const {cents} = await
|
|
79
|
+
const {cents} = await method(args);
|
|
78
80
|
|
|
79
81
|
equal(cents, expected.cents, 'Cents returned');
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
return
|
|
84
|
+
return;
|
|
83
85
|
});
|
|
84
86
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {equal} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
|
-
const
|
|
5
|
+
const method = require('./../../fiat/get_coindesk_historic_rate');
|
|
4
6
|
|
|
5
7
|
const api = ({qs}, cbk) => {
|
|
6
8
|
const bpi = {};
|
|
@@ -64,15 +66,15 @@ const tests = [
|
|
|
64
66
|
];
|
|
65
67
|
|
|
66
68
|
tests.forEach(({args, description, error, expected}) => {
|
|
67
|
-
return test(description, async (
|
|
69
|
+
return test(description, async () => {
|
|
68
70
|
if (!!error) {
|
|
69
|
-
rejects(
|
|
71
|
+
await rejects(method(args), error, 'Got expected error');
|
|
70
72
|
} else {
|
|
71
|
-
const {cents} = await
|
|
73
|
+
const {cents} = await method(args);
|
|
72
74
|
|
|
73
75
|
equal(cents, expected.cents, 'Cents returned');
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
return
|
|
78
|
+
return;
|
|
77
79
|
});
|
|
78
80
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const method = require('./../../fiat/get_coingecko_historic_rate');
|
|
4
6
|
|
|
@@ -73,15 +75,15 @@ const tests = [
|
|
|
73
75
|
];
|
|
74
76
|
|
|
75
77
|
tests.forEach(({args, description, error, expected}) => {
|
|
76
|
-
return test(description, async (
|
|
78
|
+
return test(description, async () => {
|
|
77
79
|
if (!!error) {
|
|
78
80
|
await rejects(method(args), error, 'Got expected error');
|
|
79
81
|
} else {
|
|
80
82
|
const res = await method(args);
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
deepEqual(res, expected, 'Got expected return value');
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
return
|
|
87
|
+
return;
|
|
86
88
|
});
|
|
87
89
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const {getFiatValues} = require('./../../fiat/');
|
|
4
6
|
|
|
@@ -30,10 +32,10 @@ const tests = [
|
|
|
30
32
|
currency: 'BTC',
|
|
31
33
|
dates: [date],
|
|
32
34
|
fiat: 'USD',
|
|
33
|
-
rate: ({}, cbk) => cbk('err'),
|
|
35
|
+
rate: ({}, cbk) => cbk(['err']),
|
|
34
36
|
},
|
|
35
37
|
description: 'Rate method errors are passed back',
|
|
36
|
-
error: 'err',
|
|
38
|
+
error: ['err'],
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
args: {
|
|
@@ -58,15 +60,15 @@ const tests = [
|
|
|
58
60
|
];
|
|
59
61
|
|
|
60
62
|
tests.forEach(({args, description, error, expected}) => {
|
|
61
|
-
return test(description, async (
|
|
63
|
+
return test(description, async () => {
|
|
62
64
|
if (!!error) {
|
|
63
65
|
await rejects(getFiatValues(args), error, 'Got expected error');
|
|
64
66
|
} else {
|
|
65
67
|
const {rates} = await getFiatValues(args);
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
deepEqual(rates, expected.rates, 'Rates returned');
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
return
|
|
72
|
+
return;
|
|
71
73
|
});
|
|
72
74
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {equal} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const getHistoricRate = require('./../../fiat/get_historic_rate');
|
|
4
6
|
|
|
@@ -61,15 +63,15 @@ const tests = [
|
|
|
61
63
|
];
|
|
62
64
|
|
|
63
65
|
tests.forEach(({args, description, error, expected}) => {
|
|
64
|
-
return test(description, async (
|
|
66
|
+
return test(description, async () => {
|
|
65
67
|
if (!!error) {
|
|
66
|
-
rejects(getHistoricRate(args), error, 'Gote expected error');
|
|
68
|
+
await rejects(getHistoricRate(args), error, 'Gote expected error');
|
|
67
69
|
} else {
|
|
68
70
|
const {cents} = await getHistoricRate(args);
|
|
69
71
|
|
|
70
72
|
equal(cents, expected.cents, 'Rate returned');
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
return
|
|
75
|
+
return;
|
|
74
76
|
});
|
|
75
77
|
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const {equal} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
4
|
+
const {throws} = require('node:assert').strict;
|
|
2
5
|
|
|
3
6
|
const {categorizeRecords} = require('./../../harmony');
|
|
4
7
|
|
|
@@ -138,13 +141,13 @@ const tests = [
|
|
|
138
141
|
];
|
|
139
142
|
|
|
140
143
|
tests.forEach(({args, description, error, expected}) => {
|
|
141
|
-
return test(description,
|
|
144
|
+
return test(description, (t, end) => {
|
|
142
145
|
if (!!error) {
|
|
143
146
|
throws(() => categorizeRecords(args), new Error(error), 'Got error');
|
|
144
147
|
} else {
|
|
145
|
-
const categorized =
|
|
148
|
+
const categorized = categorizeRecords(args);
|
|
146
149
|
|
|
147
|
-
|
|
150
|
+
deepEqual(categorized.payments, expected.payments, 'Categorized');
|
|
148
151
|
equal(categorized.payments_csv, expected.payments_csv, 'Categorize csv');
|
|
149
152
|
}
|
|
150
153
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
2
3
|
|
|
3
4
|
const {chainFeesAsRecords} = require('./../../harmony');
|
|
4
5
|
|
|
@@ -29,10 +30,10 @@ const tests = [
|
|
|
29
30
|
];
|
|
30
31
|
|
|
31
32
|
tests.forEach(({args, description, expected}) => {
|
|
32
|
-
return test(description, (
|
|
33
|
+
return test(description, (t, end) => {
|
|
33
34
|
const {records} = chainFeesAsRecords(args);
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
deepEqual(records, expected.records, 'Fees formatted as records');
|
|
36
37
|
|
|
37
38
|
return end();
|
|
38
39
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const {chainReceivesAsRecords} = require('./../../harmony');
|
|
4
6
|
|
|
@@ -57,13 +59,13 @@ const tests = [
|
|
|
57
59
|
];
|
|
58
60
|
|
|
59
61
|
tests.forEach(({args, description, error, expected}) => {
|
|
60
|
-
return test(description, (
|
|
62
|
+
return test(description, (t, end) => {
|
|
61
63
|
if (!!error) {
|
|
62
64
|
throws(() => chainReceivesAsRecords(args), new Error(error), 'Got err');
|
|
63
65
|
} else {
|
|
64
66
|
const {records} = chainReceivesAsRecords(args);
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
deepEqual(records, expected.records, 'Fees formatted as records');
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
return end();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
2
3
|
|
|
3
4
|
const {chainSendsAsRecords} = require('./../../harmony');
|
|
4
5
|
|
|
@@ -44,10 +45,10 @@ const tests = [
|
|
|
44
45
|
];
|
|
45
46
|
|
|
46
47
|
tests.forEach(({args, description, expected}) => {
|
|
47
|
-
return test(description, (
|
|
48
|
+
return test(description, (t, end) => {
|
|
48
49
|
const {records} = chainSendsAsRecords(args);
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
deepEqual(records, expected.records, 'Fees formatted as records');
|
|
51
52
|
|
|
52
53
|
return end();
|
|
53
54
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {equal} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const formattedNotes = require('./../../harmony/formatted_notes');
|
|
4
6
|
|
|
@@ -16,7 +18,7 @@ const tests = [
|
|
|
16
18
|
];
|
|
17
19
|
|
|
18
20
|
tests.forEach(({args, description, error, expected}) => {
|
|
19
|
-
return test(description, (
|
|
21
|
+
return test(description, (t, end) => {
|
|
20
22
|
if (!!error) {
|
|
21
23
|
throws(() => formattedNotes(args), new Error(error), 'Got error');
|
|
22
24
|
} else {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const {forwardsAsRecords} = require('./../../harmony');
|
|
4
6
|
|
|
@@ -36,13 +38,13 @@ const tests = [
|
|
|
36
38
|
];
|
|
37
39
|
|
|
38
40
|
tests.forEach(({args, description, error, expected}) => {
|
|
39
|
-
return test(description, (
|
|
41
|
+
return test(description, (t, end) => {
|
|
40
42
|
if (!!error) {
|
|
41
43
|
throws(() => forwardsAsRecords(args), new Error(error), 'Got error');
|
|
42
44
|
} else {
|
|
43
45
|
const {records} = forwardsAsRecords(args);
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
deepEqual(records, expected.records, 'Forwards formatted as records');
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
return end();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const test = require('node:test');
|
|
2
|
+
const {throws} = require('node:assert').strict;
|
|
2
3
|
|
|
3
4
|
const {harmonize} = require('./../../harmony');
|
|
4
5
|
|
|
@@ -11,7 +12,7 @@ const tests = [
|
|
|
11
12
|
];
|
|
12
13
|
|
|
13
14
|
tests.forEach(({args, description, error}) => {
|
|
14
|
-
return test(description, (
|
|
15
|
+
return test(description, (t, end) => {
|
|
15
16
|
if (!!error) {
|
|
16
17
|
throws(() => harmonize(args), new Error(error), 'Got error');
|
|
17
18
|
} else {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const {invoicesAsRecords} = require('./../../harmony');
|
|
4
6
|
|
|
@@ -61,13 +63,13 @@ const tests = [
|
|
|
61
63
|
];
|
|
62
64
|
|
|
63
65
|
tests.forEach(({args, description, error, expected}) => {
|
|
64
|
-
return test(description, (
|
|
66
|
+
return test(description, (t, end) => {
|
|
65
67
|
if (!!error) {
|
|
66
68
|
throws(() => invoicesAsRecords(args), new Error(error), 'Got error');
|
|
67
69
|
} else {
|
|
68
70
|
const {records} = invoicesAsRecords(args);
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
deepEqual(records, expected.records, 'Forwards formatted as records');
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
return end();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {equal} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
2
3
|
|
|
3
4
|
const notesForChainTx = require('./../../harmony/notes_for_chain_transaction');
|
|
4
5
|
|
|
@@ -32,7 +33,7 @@ const tests = [
|
|
|
32
33
|
];
|
|
33
34
|
|
|
34
35
|
tests.forEach(({args, description, expected}) => {
|
|
35
|
-
return test(description, (
|
|
36
|
+
return test(description, (t, end) => {
|
|
36
37
|
const {notes} = notesForChainTx(args);
|
|
37
38
|
|
|
38
39
|
equal(notes, expected.notes, 'Notes for chain transaction');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
2
3
|
|
|
3
4
|
const {paymentsAsRecords} = require('./../../harmony');
|
|
4
5
|
|
|
@@ -148,10 +149,10 @@ const tests = [
|
|
|
148
149
|
];
|
|
149
150
|
|
|
150
151
|
tests.forEach(({args, description, expected}) => {
|
|
151
|
-
return test(description, (
|
|
152
|
+
return test(description, (t, end) => {
|
|
152
153
|
const {records} = paymentsAsRecords(args);
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
deepEqual(records, expected.records, 'Forwards formatted as records');
|
|
155
156
|
|
|
156
157
|
return end();
|
|
157
158
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const {recordsWithFiat} = require('./../../harmony');
|
|
4
6
|
|
|
@@ -96,17 +98,15 @@ const tests = [
|
|
|
96
98
|
];
|
|
97
99
|
|
|
98
100
|
tests.forEach(({args, description, error, expected}) => {
|
|
99
|
-
return test(description, (
|
|
101
|
+
return test(description, (t, end) => {
|
|
100
102
|
if (!!error) {
|
|
101
103
|
throws(() => recordsWithFiat(args), new Error(error), 'Got error');
|
|
104
|
+
} else {
|
|
105
|
+
const {records} = recordsWithFiat(args);
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
deepEqual(records, expected.records, 'Fiat added to records');
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
const {records} = recordsWithFiat(args);
|
|
107
|
-
|
|
108
|
-
strictSame(records, expected.records, 'Fiat added to records');
|
|
109
|
-
|
|
110
110
|
return end();
|
|
111
111
|
});
|
|
112
112
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const {getAllInvoices} = require('./../../records');
|
|
4
6
|
|
|
@@ -89,15 +91,15 @@ const tests = [
|
|
|
89
91
|
];
|
|
90
92
|
|
|
91
93
|
tests.forEach(({args, description, error, expected}) => {
|
|
92
|
-
return test(description, async (
|
|
94
|
+
return test(description, async () => {
|
|
93
95
|
if (!!error) {
|
|
94
96
|
await rejects(getAllInvoices(args), error, 'Got expected error');
|
|
95
97
|
} else {
|
|
96
98
|
const {invoices} = await getAllInvoices(args);
|
|
97
99
|
|
|
98
|
-
|
|
100
|
+
deepEqual(invoices, expected.invoices, 'Got expected result');
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
return
|
|
103
|
+
return;
|
|
102
104
|
});
|
|
103
105
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const {rejects} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const {getAllPayments} = require('./../../records');
|
|
4
6
|
|
|
@@ -260,15 +262,15 @@ const tests = [
|
|
|
260
262
|
];
|
|
261
263
|
|
|
262
264
|
tests.forEach(({args, description, error, expected}) => {
|
|
263
|
-
return test(description, async (
|
|
265
|
+
return test(description, async () => {
|
|
264
266
|
if (!!error) {
|
|
265
267
|
await rejects(getAllPayments(args), error, 'Got expected error');
|
|
266
268
|
} else {
|
|
267
269
|
const {payments} = await getAllPayments(args);
|
|
268
270
|
|
|
269
|
-
|
|
271
|
+
deepEqual(payments, expected.payments, 'Got expected result');
|
|
270
272
|
}
|
|
271
273
|
|
|
272
|
-
return
|
|
274
|
+
return;
|
|
273
275
|
});
|
|
274
276
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {equal} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const {parseAmount} = require('./../../');
|
|
4
6
|
|
|
@@ -41,7 +43,7 @@ const tests = [
|
|
|
41
43
|
];
|
|
42
44
|
|
|
43
45
|
tests.forEach(({args, description, error, expected}) => {
|
|
44
|
-
return test(description, (
|
|
46
|
+
return test(description, (t, end) => {
|
|
45
47
|
if (!!error) {
|
|
46
48
|
throws(() => parseAmount(args), new Error(error), 'Got expected error');
|
|
47
49
|
} else {
|