@alexbosworth/blockchain 4.8.0 → 4.10.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 (48) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +34 -0
  3. package/index.js +2 -0
  4. package/package.json +12 -2
  5. package/script/conf/networks.json +27 -0
  6. package/script/index.js +2 -0
  7. package/script/output_script_for_address.js +96 -0
  8. package/.gitattributes +0 -1
  9. package/.tm_properties +0 -1
  10. package/test/5bit/test_bytes_as_words.js +0 -49
  11. package/test/5bit/test_words_as_bytes.js +0 -79
  12. package/test/addresses/test_bech32_type.js +0 -29
  13. package/test/addresses/test_decode_base58.js +0 -109
  14. package/test/addresses/test_decode_base58_address.js +0 -94
  15. package/test/addresses/test_decode_bech32.js +0 -49
  16. package/test/addresses/test_decode_bech32_address.js +0 -188
  17. package/test/addresses/test_encode_base58_address.js +0 -127
  18. package/test/addresses/test_encode_bech32.js +0 -69
  19. package/test/addresses/test_encode_bech32_address.js +0 -167
  20. package/test/fixtures/tx_invalid.json +0 -397
  21. package/test/fixtures/tx_valid.json +0 -528
  22. package/test/hashes/test_hash_for_p2pkh.js +0 -54
  23. package/test/hashes/test_hash_for_p2wpkh.js +0 -54
  24. package/test/hashes/test_id_for_block.js +0 -38
  25. package/test/hashes/test_no_locktime_id_for_transaction.js +0 -56
  26. package/test/hashes/test_previous_block_id.js +0 -38
  27. package/test/numbers/test_compact_int_as_number.js +0 -104
  28. package/test/numbers/test_encode_push_bytes_count.js +0 -82
  29. package/test/numbers/test_number_as_compact_int.js +0 -77
  30. package/test/numbers/test_number_as_little_endian.js +0 -77
  31. package/test/numbers/test_parse_push_bytes_count.js +0 -67
  32. package/test/script/test_p2ms_script.js +0 -106
  33. package/test/script/test_p2pkh_output_script.js +0 -41
  34. package/test/script/test_p2sh_output_script.js +0 -41
  35. package/test/script/test_p2tr_output_script.js +0 -43
  36. package/test/script/test_p2wpkh_output_script.js +0 -41
  37. package/test/script/test_p2wsh_output_script.js +0 -43
  38. package/test/script/test_script_as_script_elements.js +0 -84
  39. package/test/script/test_script_elements_as_script.js +0 -72
  40. package/test/transactions/test_components_of_transaction.js +0 -352
  41. package/test/transactions/test_core_tx_vectors.js +0 -70
  42. package/test/transactions/test_id_for_transaction.js +0 -72
  43. package/test/transactions/test_non_witness_hash_to_sign.js +0 -404
  44. package/test/transactions/test_query_transactions.js +0 -87
  45. package/test/transactions/test_size_of_transaction.js +0 -84
  46. package/test/transactions/test_transaction_from_components.js +0 -281
  47. package/test/transactions/test_unsigned_tx_from_psbt.js +0 -89
  48. package/test/transactions/test_v0_hash_to_sign.js +0 -262
@@ -1,106 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {p2msScript} = require('./../../');
6
-
7
- const bufferFromHex = hex => Buffer.from(hex, 'hex');
8
-
9
- // Public keys from the BIP 143 P2SH-P2WSH 6-of-6 multisig example
10
- const bip143MultisigKeys = [
11
- '0307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba3',
12
- '03b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b',
13
- '034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a',
14
- '033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f4',
15
- '03a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac16',
16
- '02d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b',
17
- ];
18
-
19
- // Twenty derived placeholder public keys to test past the op number range
20
- const twentyKeys = bip143MultisigKeys
21
- .concat(bip143MultisigKeys)
22
- .concat(bip143MultisigKeys)
23
- .slice(0, 18)
24
- .concat(['0307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba3'])
25
- .concat(['03b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b']);
26
-
27
- const tests = [
28
- {
29
- args: {},
30
- description: 'An array of public keys is required',
31
- error: 'ExpectedArrayOfPublicKeysToDeriveP2msScript',
32
- },
33
- {
34
- args: {keys: []},
35
- description: 'A non empty array of public keys is required',
36
- error: 'ExpectedArrayOfPublicKeysToDeriveP2msScript',
37
- },
38
- {
39
- args: {keys: twentyKeys.concat(twentyKeys).map(bufferFromHex)},
40
- description: 'A maximum of twenty public keys is required',
41
- error: 'ExpectedFewerPublicKeysToDeriveP2msScript',
42
- },
43
- {
44
- args: {keys: [bufferFromHex('00')]},
45
- description: 'Compressed public keys are required',
46
- error: 'ExpectedCompressedPublicKeysToDeriveP2msScript',
47
- },
48
- {
49
- args: {keys: [null], required: 1},
50
- description: 'Defined public keys are required',
51
- error: 'ExpectedCompressedPublicKeysToDeriveP2msScript',
52
- },
53
- {
54
- args: {keys: bip143MultisigKeys.map(bufferFromHex)},
55
- description: 'A required keys count is required',
56
- error: 'ExpectedRequiredKeysCountToDeriveP2msScript',
57
- },
58
- {
59
- args: {keys: bip143MultisigKeys.map(bufferFromHex), required: 1.5},
60
- description: 'An integer required keys count is required',
61
- error: 'ExpectedRequiredKeysCountToDeriveP2msScript',
62
- },
63
- {
64
- args: {keys: bip143MultisigKeys.map(bufferFromHex), required: 7},
65
- description: 'A required count within the keys count is required',
66
- error: 'UnexpectedCountOfRequiredKeysToDeriveP2msScript',
67
- },
68
- {
69
- args: {keys: bip143MultisigKeys.map(bufferFromHex), required: 6},
70
- description: 'A multisig script is derived for the BIP 143 example keys',
71
- expected: {
72
- hash: bufferFromHex('a16b5755f7f6f96dbd65f5f0d6ab9418b89af4b1f14a1bb8a09062c35f0dcb54'),
73
- script: bufferFromHex('56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56ae'),
74
- },
75
- },
76
- {
77
- args: {keys: bip143MultisigKeys.slice(0, 3).map(bufferFromHex), required: 2},
78
- description: 'A two of three multisig script is derived',
79
- expected: {
80
- hash: bufferFromHex('04facdf99ba64a979191911d7643e52af145ac7b5eb3168c16bec40702f6b9d2'),
81
- script: bufferFromHex('52210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a53ae'),
82
- },
83
- },
84
- {
85
- args: {keys: twentyKeys.map(bufferFromHex), required: 17},
86
- description: 'Counts past the op number range are encoded as data pushes',
87
- expected: {
88
- hash: bufferFromHex('01312333beba0c1b3a3814d64296528cbeb9a344356d606baabd4782204a3c6c'),
89
- script: bufferFromHex('0111210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b0114ae'),
90
- },
91
- },
92
- ];
93
-
94
- tests.forEach(({args, description, error, expected}) => {
95
- return test(description, (t, end) => {
96
- if (!!error) {
97
- throws(() => p2msScript(args), new Error(error), 'Got err');
98
- } else {
99
- const res = p2msScript(args);
100
-
101
- deepStrictEqual(res, expected, 'Got expected result');
102
- }
103
-
104
- return end();
105
- });
106
- });
@@ -1,41 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {p2pkhOutputScript} = require('./../../');
6
-
7
- const bufferFromHex = hex => Buffer.from(hex, 'hex');
8
-
9
- const tests = [
10
- {
11
- args: {},
12
- description: 'A hash is required',
13
- error: 'ExpectedPublicKeyHashToDeriveOutputScript',
14
- },
15
- {
16
- args: {hash: bufferFromHex('12ab8dc588ca9d5787dde7eb29569da63c3a23')},
17
- description: 'A correctly sized hash is required',
18
- error: 'UnexpectedHashLengthForPublicKeyHashOutputScript',
19
- },
20
- {
21
- args: {hash: bufferFromHex('12ab8dc588ca9d5787dde7eb29569da63c3a238c')},
22
- description: 'An output script is derived for a hash',
23
- expected: {
24
- script: bufferFromHex('76a91412ab8dc588ca9d5787dde7eb29569da63c3a238c88ac'),
25
- },
26
- },
27
- ];
28
-
29
- tests.forEach(({args, description, error, expected}) => {
30
- return test(description, (t, end) => {
31
- if (!!error) {
32
- throws(() => p2pkhOutputScript(args), new Error(error), 'Got err');
33
- } else {
34
- const res = p2pkhOutputScript(args);
35
-
36
- deepStrictEqual(res, expected, 'Got expected result');
37
- }
38
-
39
- return end();
40
- });
41
- });
@@ -1,41 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {p2shOutputScript} = require('./../../');
6
-
7
- const bufferFromHex = hex => Buffer.from(hex, 'hex');
8
-
9
- const tests = [
10
- {
11
- args: {},
12
- description: 'A hash is required',
13
- error: 'ExpectedScriptHashToDerivePayToScriptOutputScript',
14
- },
15
- {
16
- args: {hash: bufferFromHex('433ec2ac1ffa1b7b7d027f564529c57197f9ae')},
17
- description: 'A correctly sized hash is required',
18
- error: 'UnexpectedHashLengthForPayToScriptHashOutputScript',
19
- },
20
- {
21
- args: {hash: bufferFromHex('433ec2ac1ffa1b7b7d027f564529c57197f9ae88')},
22
- description: 'An output script is derived for a hash',
23
- expected: {
24
- script: bufferFromHex('a914433ec2ac1ffa1b7b7d027f564529c57197f9ae8887'),
25
- },
26
- },
27
- ];
28
-
29
- tests.forEach(({args, description, error, expected}) => {
30
- return test(description, (t, end) => {
31
- if (!!error) {
32
- throws(() => p2shOutputScript(args), new Error(error), 'Got err');
33
- } else {
34
- const res = p2shOutputScript(args);
35
-
36
- deepStrictEqual(res, expected, 'Got expected result');
37
- }
38
-
39
- return end();
40
- });
41
- });
@@ -1,43 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {p2trOutputScript} = require('./../../');
6
-
7
- const bufferFromHex = hex => Buffer.from(hex, 'hex');
8
-
9
- const tests = [
10
- {
11
- args: {},
12
- description: 'A hash is required',
13
- error: 'ExpectedTaprootHashToDeriveOutputScript',
14
- },
15
- {
16
- args: {hash: bufferFromHex('8d7a0a3461e3891723e5fdf8129caa0075060c')},
17
- description: 'A correctly sized hash is required',
18
- error: 'ExpectedKnownLengthTaprootHashForOutputScript',
19
- },
20
- {
21
- args: {
22
- hash: bufferFromHex('667bdd93c7c029767fd516d2ea292624b938fefefa175ac9f1220cf508963ff3'),
23
- },
24
- description: 'An output script is derived for a hash',
25
- expected: {
26
- script: bufferFromHex('5120667bdd93c7c029767fd516d2ea292624b938fefefa175ac9f1220cf508963ff3'),
27
- },
28
- },
29
- ];
30
-
31
- tests.forEach(({args, description, error, expected}) => {
32
- return test(description, (t, end) => {
33
- if (!!error) {
34
- throws(() => p2trOutputScript(args), new Error(error), 'Got err');
35
- } else {
36
- const res = p2trOutputScript(args);
37
-
38
- deepStrictEqual(res, expected, 'Got expected result');
39
- }
40
-
41
- return end();
42
- });
43
- });
@@ -1,41 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {p2wpkhOutputScript} = require('./../../');
6
-
7
- const bufferFromHex = hex => Buffer.from(hex, 'hex');
8
-
9
- const tests = [
10
- {
11
- args: {},
12
- description: 'A hash is required',
13
- error: 'ExpectedWitnessPublicKeyHashToDeriveOutputScript',
14
- },
15
- {
16
- args: {hash: bufferFromHex('8d7a0a3461e3891723e5fdf8129caa0075060c')},
17
- description: 'A correctly sized hash is required',
18
- error: 'ExpectedKnownLengthWitnessPublicKeyHashForOutputScript',
19
- },
20
- {
21
- args: {hash: bufferFromHex('8d7a0a3461e3891723e5fdf8129caa0075060cff')},
22
- description: 'An output script is derived for a hash',
23
- expected: {
24
- script: bufferFromHex('00148d7a0a3461e3891723e5fdf8129caa0075060cff'),
25
- },
26
- },
27
- ];
28
-
29
- tests.forEach(({args, description, error, expected}) => {
30
- return test(description, (t, end) => {
31
- if (!!error) {
32
- throws(() => p2wpkhOutputScript(args), new Error(error), 'Got err');
33
- } else {
34
- const res = p2wpkhOutputScript(args);
35
-
36
- deepStrictEqual(res, expected, 'Got expected result');
37
- }
38
-
39
- return end();
40
- });
41
- });
@@ -1,43 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {p2wshOutputScript} = require('./../../');
6
-
7
- const bufferFromHex = hex => Buffer.from(hex, 'hex');
8
-
9
- const tests = [
10
- {
11
- args: {},
12
- description: 'A hash is required',
13
- error: 'ExpectedWitnessScriptHashToDeriveOutputScript',
14
- },
15
- {
16
- args: {hash: bufferFromHex('8d7a0a3461e3891723e5fdf8129caa0075060c')},
17
- description: 'A correctly sized hash is required',
18
- error: 'ExpectedKnownLengthWitnessScriptHashForOutputScript',
19
- },
20
- {
21
- args: {
22
- hash: bufferFromHex('cdbf909e935c855d3e8d1b61aeb9c5e3c03ae8021b286839b1a72f2e48fdba70'),
23
- },
24
- description: 'An output script is derived for a hash',
25
- expected: {
26
- script: bufferFromHex('0020cdbf909e935c855d3e8d1b61aeb9c5e3c03ae8021b286839b1a72f2e48fdba70'),
27
- },
28
- },
29
- ];
30
-
31
- tests.forEach(({args, description, error, expected}) => {
32
- return test(description, (t, end) => {
33
- if (!!error) {
34
- throws(() => p2wshOutputScript(args), new Error(error), 'Got err');
35
- } else {
36
- const res = p2wshOutputScript(args);
37
-
38
- deepStrictEqual(res, expected, 'Got expected result');
39
- }
40
-
41
- return end();
42
- });
43
- });
@@ -1,84 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {scriptAsScriptElements} = require('./../../');
6
-
7
- const tests = [
8
- {
9
- args: {script: 'z'},
10
- description: 'A script is required',
11
- error: 'ExpectedHexEncodedScriptToDecodeScriptElements',
12
- },
13
- {
14
- args: {script: '76a914000000000000000000000000000000000000000088ac'},
15
- description: 'An output script is mapped to elements',
16
- expected: {elements: [118, 169, Buffer.alloc(20), 136, 172]},
17
- },
18
- {
19
- args: {script: '000100'},
20
- description: 'Zero bytes on the stack',
21
- expected: {elements: [0, Buffer.alloc(1)]},
22
- },
23
- {
24
- args: {
25
- script: '4cff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
26
- },
27
- description: 'Long data push',
28
- expected: {elements: [Buffer.alloc(255)]},
29
- },
30
- {
31
- args: {script: '01'},
32
- description: 'Specify one byte, but there is zero bytes',
33
- expected: {},
34
- },
35
- {
36
- args: {script: '0201'},
37
- description: 'Specify two bytes but there is only one',
38
- expected: {},
39
- },
40
- {
41
- args: {script: '4c'},
42
- description: 'Not any data for pushdata 1',
43
- expected: {},
44
- },
45
- {
46
- args: {script: '4c0201'},
47
- description: 'Not enough data for pushdata 1',
48
- expected: {},
49
- },
50
- {
51
- args: {script: '4dffff01'},
52
- description: 'Not enough data for pushdata 2',
53
- expected: {},
54
- },
55
- {
56
- args: {script: '4dff'},
57
- description: 'Not enough data for pushdata 2 number',
58
- expected: {},
59
- },
60
- {
61
- args: {script: '4effffffff01'},
62
- description: 'Not enough data for pushdata 4',
63
- expected: {},
64
- },
65
- {
66
- args: {script: '4eff'},
67
- description: 'Not enough data for pushdata 4 number',
68
- expected: {},
69
- },
70
- ];
71
-
72
- tests.forEach(({args, description, error, expected}) => {
73
- return test(description, (t, end) => {
74
- if (!!error) {
75
- throws(() => scriptAsScriptElements(args), new Error(error), 'Got err');
76
- } else {
77
- const res = scriptAsScriptElements(args);
78
-
79
- deepStrictEqual(res, expected, 'Got expected result');
80
- }
81
-
82
- return end();
83
- });
84
- });
@@ -1,72 +0,0 @@
1
- const {deepStrictEqual} = require('node:assert').strict;
2
- const {throws} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {scriptElementsAsScript} = require('./../../');
6
-
7
- const tests = [
8
- {
9
- args: {},
10
- description: 'An array of elements is required',
11
- error: 'ExpectedArrayOfScriptElementsToEncodeScript',
12
- },
13
- {
14
- args: {elements: []},
15
- description: 'No elements are mapped to an empty script',
16
- expected: {script: ''},
17
- },
18
- {
19
- args: {elements: [Buffer.alloc(76)]},
20
- description: 'A data element beyond direct push uses OP_PUSHDATA1',
21
- expected: {script: '4c4c' + '00'.repeat(76)},
22
- },
23
- {
24
- args: {elements: [Buffer.alloc(256)]},
25
- description: 'A data element beyond one byte length uses OP_PUSHDATA2',
26
- expected: {script: '4d0001' + '00'.repeat(256)},
27
- },
28
- {
29
- args: {elements: [Buffer.alloc(70000)]},
30
- description: 'A data element beyond two byte length uses OP_PUSHDATA4',
31
- expected: {script: '4e70110100' + '00'.repeat(70000)},
32
- },
33
- {
34
- args: {elements: [300, Buffer.alloc(20)]},
35
- description: 'Op code elements above a single byte value are rejected',
36
- error: 'ExpectedSingleByteOpCodeElementToFormOutputScript',
37
- },
38
- {
39
- args: {elements: [-1, Buffer.alloc(20)]},
40
- description: 'Negative op code elements are rejected',
41
- error: 'ExpectedSingleByteOpCodeElementToFormOutputScript',
42
- },
43
- {
44
- args: {elements: ['76', Buffer.alloc(20)]},
45
- description: 'Non number op code elements are rejected',
46
- error: 'ExpectedDataOrOpCodeScriptElementsToEncodeScript',
47
- },
48
- {
49
- args: {elements: [0, Buffer.alloc(75)]},
50
- description: 'A maximum length direct data push is encoded',
51
- expected: {script: '004b' + '00'.repeat(75)},
52
- },
53
- {
54
- args: {elements: [118, 169, Buffer.alloc(20), 136, 172]},
55
- description: 'Elements are mapped to an output script',
56
- expected: {script: '76a914000000000000000000000000000000000000000088ac'},
57
- },
58
- ];
59
-
60
- tests.forEach(({args, description, error, expected}) => {
61
- return test(description, (t, end) => {
62
- if (!!error) {
63
- throws(() => scriptElementsAsScript(args), new Error(error), 'Got err');
64
- } else {
65
- const res = scriptElementsAsScript(args);
66
-
67
- deepStrictEqual(res, expected, 'Got expected result');
68
- }
69
-
70
- return end();
71
- });
72
- });