ln-accounting 10.0.7 → 10.0.9
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 +4 -1
- package/esplora/get_esplora_vout.js +0 -1
- package/package.json +23 -8
- package/report/get_accounting_report.js +4 -1
- package/.gitattributes +0 -1
- package/.tm_properties +0 -1
- package/.travis.yml +0 -15
- package/blockstream/get_blockstream_tx.js +0 -94
- package/blockstream/get_blockstream_vout.js +0 -80
- package/blockstream/index.js +0 -4
- package/test/blockstream/test_get_blockstream_tx.js +0 -111
- package/test/fiat/test_get_coincap_historic_rate.js +0 -86
- package/test/fiat/test_get_coindesk_historic_rate.js +0 -80
- package/test/fiat/test_get_coingecko_historic_rate.js +0 -89
- package/test/fiat/test_get_fiat_values.js +0 -74
- package/test/fiat/test_get_historic_rate.js +0 -77
- package/test/harmony/test_categorize_records.js +0 -156
- package/test/harmony/test_chain_fees_as_records.js +0 -40
- package/test/harmony/test_chain_receives_as_records.js +0 -73
- package/test/harmony/test_chain_sends_as_records.js +0 -55
- package/test/harmony/test_formatted_notes.js +0 -32
- package/test/harmony/test_forwards_as_records.js +0 -52
- package/test/harmony/test_harmonize.js +0 -24
- package/test/harmony/test_invoices_as_records.js +0 -77
- package/test/harmony/test_notes_for_chain_transaction.js +0 -43
- package/test/harmony/test_payments_as_records.js +0 -159
- package/test/harmony/test_records_with_fiat.js +0 -112
- package/test/records/test_get_all_invoices.js +0 -105
- package/test/records/test_get_all_payments.js +0 -274
- package/test/report/test_parse_amount.js +0 -57
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const {equal} = require('node:assert').strict;
|
|
2
|
-
const test = require('node:test');
|
|
3
|
-
const {throws} = require('node:assert').strict;
|
|
4
|
-
|
|
5
|
-
const {parseAmount} = require('./../../');
|
|
6
|
-
|
|
7
|
-
const tests = [
|
|
8
|
-
{
|
|
9
|
-
args: {amount: 'amount'},
|
|
10
|
-
description: 'A value is required',
|
|
11
|
-
error: 'ExpectedAllKnownConstantsInFormulaToEvaluate',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
args: {amount: '1/0'},
|
|
15
|
-
description: 'Dividing by zero is not allowed',
|
|
16
|
-
error: 'ExpectedNonZeroDivisorForFormulaEvaluation',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
args: {amount: '0.0.0'},
|
|
20
|
-
description: 'A generic invalid amount is rejected',
|
|
21
|
-
error: 'UnexpectedInvalidDecimalNumberValue',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
args: {amount: 'OCT2DEC()'},
|
|
25
|
-
description: 'Invalid functions are rejected',
|
|
26
|
-
error: 'UnexpectedFunctionForFormulaEvaluation',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
args: {amount: '"string" + 1'},
|
|
30
|
-
description: 'Invalid formulas are rejected',
|
|
31
|
-
error: 'ExpectedBoolOrFiniteNumberForNumberConversion',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
args: {amount: '1.20969468*btc', variables: {variable: 'value'}},
|
|
35
|
-
description: 'A long precision BTC value is parsed',
|
|
36
|
-
expected: {tokens: 120969468},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
args: {amount: '1.20969465*btc'},
|
|
40
|
-
description: 'A long precision BTC value that rounds down is parsed',
|
|
41
|
-
expected: {tokens: 120969465},
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
tests.forEach(({args, description, error, expected}) => {
|
|
46
|
-
return test(description, (t, end) => {
|
|
47
|
-
if (!!error) {
|
|
48
|
-
throws(() => parseAmount(args), new Error(error), 'Got expected error');
|
|
49
|
-
} else {
|
|
50
|
-
const {tokens} = parseAmount(args);
|
|
51
|
-
|
|
52
|
-
equal(tokens, expected.tokens, 'Got expected output');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return end();
|
|
56
|
-
});
|
|
57
|
-
});
|