@btc-vision/bitcoin 6.4.0 → 6.4.1

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.
@@ -1,337 +1,337 @@
1
- import assert from 'assert';
2
- import { beforeEach, describe, it } from 'mocha';
3
- import { Transaction } from '../src/index.js';
4
- import * as bscript from '../src/script.js';
5
- import fixtures from './fixtures/transaction.json' with { type: 'json' };
6
-
7
- describe('Transaction', () => {
8
- function fromRaw(raw: any, noWitness?: boolean): Transaction {
9
- const tx = new Transaction();
10
- tx.version = raw.version;
11
- tx.locktime = raw.locktime;
12
-
13
- raw.ins.forEach((txIn: any, i: number) => {
14
- const txHash = Buffer.from(txIn.hash, 'hex');
15
- let scriptSig;
16
-
17
- if (txIn.data) {
18
- scriptSig = Buffer.from(txIn.data, 'hex');
19
- } else if (txIn.script) {
20
- scriptSig = bscript.fromASM(txIn.script);
21
- }
22
-
23
- tx.addInput(txHash, txIn.index, txIn.sequence, scriptSig);
24
-
25
- if (!noWitness && txIn.witness) {
26
- const witness = txIn.witness.map((x: string) => {
27
- return Buffer.from(x, 'hex');
28
- });
29
-
30
- tx.setWitness(i, witness);
31
- }
32
- });
33
-
34
- raw.outs.forEach((txOut: any) => {
35
- let script: Buffer;
36
-
37
- if (txOut.data) {
38
- script = Buffer.from(txOut.data, 'hex');
39
- } else if (txOut.script) {
40
- script = bscript.fromASM(txOut.script);
41
- }
42
-
43
- tx.addOutput(script!, txOut.value);
44
- });
45
-
46
- return tx;
47
- }
48
-
49
- describe('fromBuffer/fromHex', () => {
50
- function importExport(f: any): void {
51
- const id = f.id || f.hash;
52
- const txHex = f.hex || f.txHex;
53
-
54
- it('imports ' + f.description + ' (' + id + ')', () => {
55
- const actual = Transaction.fromHex(txHex);
56
-
57
- assert.strictEqual(actual.toHex(), txHex);
58
- });
59
-
60
- if (f.whex) {
61
- it('imports ' + f.description + ' (' + id + ') as witness', () => {
62
- const actual = Transaction.fromHex(f.whex);
63
-
64
- assert.strictEqual(actual.toHex(), f.whex);
65
- });
66
- }
67
- }
68
-
69
- fixtures.valid.forEach(importExport);
70
- fixtures.hashForSignature.forEach(importExport);
71
- fixtures.hashForWitnessV0.forEach(importExport);
72
-
73
- fixtures.invalid.fromBuffer.forEach((f) => {
74
- it('throws on ' + f.exception, () => {
75
- assert.throws(() => {
76
- Transaction.fromHex(f.hex);
77
- }, new RegExp(f.exception));
78
- });
79
- });
80
-
81
- it('.version should be interpreted as an int32le', () => {
82
- const txHex = 'ffffffff0000ffffffff';
83
- const tx = Transaction.fromHex(txHex);
84
- assert.strictEqual(-1, tx.version);
85
- assert.strictEqual(0xffffffff, tx.locktime);
86
- });
87
- });
88
-
89
- describe('toBuffer/toHex', () => {
90
- fixtures.valid.forEach((f) => {
91
- it('exports ' + f.description + ' (' + f.id + ')', () => {
92
- const actual = fromRaw(f.raw, true);
93
- assert.strictEqual(actual.toHex(), f.hex);
94
- });
95
-
96
- if (f.whex) {
97
- it('exports ' + f.description + ' (' + f.id + ') as witness', () => {
98
- const wactual = fromRaw(f.raw);
99
- assert.strictEqual(wactual.toHex(), f.whex);
100
- });
101
- }
102
- });
103
-
104
- it('accepts target Buffer and offset parameters', () => {
105
- const f = fixtures.valid[0];
106
- const actual = fromRaw(f.raw);
107
- const byteLength = actual.byteLength();
108
-
109
- const target = Buffer.alloc(byteLength * 2);
110
- const a = actual.toBuffer(target, 0);
111
- const b = actual.toBuffer(target, byteLength);
112
-
113
- assert.strictEqual(a.length, byteLength);
114
- assert.strictEqual(b.length, byteLength);
115
- assert.strictEqual(a.toString('hex'), f.hex);
116
- assert.strictEqual(b.toString('hex'), f.hex);
117
- assert.deepStrictEqual(a, b);
118
- assert.deepStrictEqual(a, target.slice(0, byteLength));
119
- assert.deepStrictEqual(b, target.slice(byteLength));
120
- });
121
- });
122
-
123
- describe('hasWitnesses', () => {
124
- fixtures.valid.forEach((f) => {
125
- it('detects if the transaction has witnesses: ' + (f.whex ? 'true' : 'false'), () => {
126
- assert.strictEqual(
127
- Transaction.fromHex(f.whex ? f.whex : f.hex).hasWitnesses(),
128
- !!f.whex,
129
- );
130
- });
131
- });
132
- });
133
-
134
- describe('weight/virtualSize', () => {
135
- it('computes virtual size', () => {
136
- fixtures.valid.forEach((f) => {
137
- const transaction = Transaction.fromHex(f.whex ? f.whex : f.hex);
138
-
139
- assert.strictEqual(transaction.virtualSize(), f.virtualSize);
140
- });
141
- });
142
-
143
- it('computes weight', () => {
144
- fixtures.valid.forEach((f) => {
145
- const transaction = Transaction.fromHex(f.whex ? f.whex : f.hex);
146
-
147
- assert.strictEqual(transaction.weight(), f.weight);
148
- });
149
- });
150
- });
151
-
152
- describe('addInput', () => {
153
- let prevTxHash: Buffer;
154
- beforeEach(() => {
155
- prevTxHash = Buffer.from(
156
- 'ffffffff00ffff000000000000000000000000000000000000000000101010ff',
157
- 'hex',
158
- );
159
- });
160
-
161
- it('returns an index', () => {
162
- const tx = new Transaction();
163
- assert.strictEqual(tx.addInput(prevTxHash, 0), 0);
164
- assert.strictEqual(tx.addInput(prevTxHash, 0), 1);
165
- });
166
-
167
- it('defaults to empty script, witness and 0xffffffff SEQUENCE number', () => {
168
- const tx = new Transaction();
169
- tx.addInput(prevTxHash, 0);
170
-
171
- assert.strictEqual(tx.ins[0].script.length, 0);
172
- assert.strictEqual(tx.ins[0].witness.length, 0);
173
- assert.strictEqual(tx.ins[0].sequence, 0xffffffff);
174
- });
175
-
176
- fixtures.invalid.addInput.forEach((f) => {
177
- it('throws on ' + f.exception, () => {
178
- const tx = new Transaction();
179
- const hash = Buffer.from(f.hash, 'hex');
180
-
181
- assert.throws(() => {
182
- tx.addInput(hash, f.index);
183
- }, new RegExp(f.exception));
184
- });
185
- });
186
- });
187
-
188
- describe('addOutput', () => {
189
- it('returns an index', () => {
190
- const tx = new Transaction();
191
- assert.strictEqual(tx.addOutput(Buffer.alloc(0), 0), 0);
192
- assert.strictEqual(tx.addOutput(Buffer.alloc(0), 0), 1);
193
- });
194
- });
195
-
196
- describe('clone', () => {
197
- fixtures.valid.forEach((f) => {
198
- let actual: Transaction;
199
- let expected: Transaction;
200
-
201
- beforeEach(() => {
202
- expected = Transaction.fromHex(f.hex);
203
- actual = expected.clone();
204
- });
205
-
206
- it('should have value equality', () => {
207
- assert.deepStrictEqual(actual, expected);
208
- });
209
-
210
- it('should not have reference equality', () => {
211
- assert.notStrictEqual(actual, expected);
212
- });
213
- });
214
- });
215
-
216
- describe('getHash/getId', () => {
217
- function verify(f: any): void {
218
- it('should return the id for ' + f.id + '(' + f.description + ')', () => {
219
- const tx = Transaction.fromHex(f.whex || f.hex);
220
-
221
- assert.strictEqual(tx.getHash().toString('hex'), f.hash);
222
- assert.strictEqual(tx.getId(), f.id);
223
- });
224
- }
225
-
226
- fixtures.valid.forEach(verify);
227
- });
228
-
229
- describe('isCoinbase', () => {
230
- function verify(f: any): void {
231
- it('should return ' + f.coinbase + ' for ' + f.id + '(' + f.description + ')', () => {
232
- const tx = Transaction.fromHex(f.hex);
233
-
234
- assert.strictEqual(tx.isCoinbase(), f.coinbase);
235
- });
236
- }
237
-
238
- fixtures.valid.forEach(verify);
239
- });
240
-
241
- describe('hashForSignature', () => {
242
- it('does not use Witness serialization', () => {
243
- const randScript = Buffer.from('6a', 'hex');
244
-
245
- const tx = new Transaction();
246
- tx.addInput(
247
- Buffer.from(
248
- '0000000000000000000000000000000000000000000000000000000000000000',
249
- 'hex',
250
- ),
251
- 0,
252
- );
253
- tx.addOutput(randScript, 5000000000);
254
-
255
- const original = (tx as any).__toBuffer;
256
- (tx as any).__toBuffer = function (this: Transaction, a: any, b: any, c: any): any {
257
- if (c !== false) throw new Error('hashForSignature MUST pass false');
258
-
259
- return original.call(this, a, b, c);
260
- };
261
-
262
- assert.throws(() => {
263
- (tx as any).__toBuffer(undefined, undefined, true);
264
- }, /hashForSignature MUST pass false/);
265
-
266
- // assert hashForSignature does not pass false
267
- assert.doesNotThrow(() => {
268
- tx.hashForSignature(0, randScript, 1);
269
- });
270
- });
271
-
272
- fixtures.hashForSignature.forEach((f) => {
273
- it(
274
- 'should return ' +
275
- f.hash +
276
- ' for ' +
277
- (f.description ? 'case "' + f.description + '"' : f.script),
278
- () => {
279
- const tx = Transaction.fromHex(f.txHex);
280
- const script = bscript.fromASM(f.script);
281
-
282
- assert.strictEqual(
283
- tx.hashForSignature(f.inIndex, script, f.type).toString('hex'),
284
- f.hash,
285
- );
286
- },
287
- );
288
- });
289
- });
290
-
291
- describe('hashForWitnessV0', () => {
292
- fixtures.hashForWitnessV0.forEach((f) => {
293
- it(
294
- 'should return ' +
295
- f.hash +
296
- ' for ' +
297
- (f.description ? 'case "' + f.description + '"' : ''),
298
- () => {
299
- const tx = Transaction.fromHex(f.txHex);
300
- const script = bscript.fromASM(f.script);
301
-
302
- assert.strictEqual(
303
- tx.hashForWitnessV0(f.inIndex, script, f.value, f.type).toString('hex'),
304
- f.hash,
305
- );
306
- },
307
- );
308
- });
309
- });
310
-
311
- describe('taprootSigning', () => {
312
- fixtures.taprootSigning.forEach((f) => {
313
- const tx = Transaction.fromHex(f.txHex);
314
- const prevOutScripts = f.utxos.map(({ scriptHex }) => Buffer.from(scriptHex, 'hex'));
315
- const values = f.utxos.map(({ value }) => value);
316
-
317
- f.cases.forEach((c) => {
318
- let hash: Buffer;
319
-
320
- it(`should hash to ${c.hash} for ${f.description}:${c.vin}`, () => {
321
- const hashType = Buffer.from(c.typeHex, 'hex').readUInt8(0);
322
-
323
- hash = tx.hashForWitnessV1(c.vin, prevOutScripts, values, hashType);
324
- assert.strictEqual(hash.toString('hex'), c.hash);
325
- });
326
- });
327
- });
328
- });
329
-
330
- describe('setWitness', () => {
331
- it('only accepts a witness stack (Array of Buffers)', () => {
332
- assert.throws(() => {
333
- (new Transaction().setWitness as any)(0, 'foobar');
334
- }, /Expected property "1" of type \[Buffer], got String "foobar"/);
335
- });
336
- });
337
- });
1
+ import assert from 'assert';
2
+ import { beforeEach, describe, it } from 'mocha';
3
+ import { Transaction } from '../src/index.js';
4
+ import * as bscript from '../src/script.js';
5
+ import fixtures from './fixtures/transaction.json' with { type: 'json' };
6
+
7
+ describe('Transaction', () => {
8
+ function fromRaw(raw: any, noWitness?: boolean): Transaction {
9
+ const tx = new Transaction();
10
+ tx.version = raw.version;
11
+ tx.locktime = raw.locktime;
12
+
13
+ raw.ins.forEach((txIn: any, i: number) => {
14
+ const txHash = Buffer.from(txIn.hash, 'hex');
15
+ let scriptSig;
16
+
17
+ if (txIn.data) {
18
+ scriptSig = Buffer.from(txIn.data, 'hex');
19
+ } else if (txIn.script) {
20
+ scriptSig = bscript.fromASM(txIn.script);
21
+ }
22
+
23
+ tx.addInput(txHash, txIn.index, txIn.sequence, scriptSig);
24
+
25
+ if (!noWitness && txIn.witness) {
26
+ const witness = txIn.witness.map((x: string) => {
27
+ return Buffer.from(x, 'hex');
28
+ });
29
+
30
+ tx.setWitness(i, witness);
31
+ }
32
+ });
33
+
34
+ raw.outs.forEach((txOut: any) => {
35
+ let script: Buffer;
36
+
37
+ if (txOut.data) {
38
+ script = Buffer.from(txOut.data, 'hex');
39
+ } else if (txOut.script) {
40
+ script = bscript.fromASM(txOut.script);
41
+ }
42
+
43
+ tx.addOutput(script!, txOut.value);
44
+ });
45
+
46
+ return tx;
47
+ }
48
+
49
+ describe('fromBuffer/fromHex', () => {
50
+ function importExport(f: any): void {
51
+ const id = f.id || f.hash;
52
+ const txHex = f.hex || f.txHex;
53
+
54
+ it('imports ' + f.description + ' (' + id + ')', () => {
55
+ const actual = Transaction.fromHex(txHex);
56
+
57
+ assert.strictEqual(actual.toHex(), txHex);
58
+ });
59
+
60
+ if (f.whex) {
61
+ it('imports ' + f.description + ' (' + id + ') as witness', () => {
62
+ const actual = Transaction.fromHex(f.whex);
63
+
64
+ assert.strictEqual(actual.toHex(), f.whex);
65
+ });
66
+ }
67
+ }
68
+
69
+ fixtures.valid.forEach(importExport);
70
+ fixtures.hashForSignature.forEach(importExport);
71
+ fixtures.hashForWitnessV0.forEach(importExport);
72
+
73
+ fixtures.invalid.fromBuffer.forEach((f) => {
74
+ it('throws on ' + f.exception, () => {
75
+ assert.throws(() => {
76
+ Transaction.fromHex(f.hex);
77
+ }, new RegExp(f.exception));
78
+ });
79
+ });
80
+
81
+ it('.version should be interpreted as an int32le', () => {
82
+ const txHex = 'ffffffff0000ffffffff';
83
+ const tx = Transaction.fromHex(txHex);
84
+ assert.strictEqual(-1, tx.version);
85
+ assert.strictEqual(0xffffffff, tx.locktime);
86
+ });
87
+ });
88
+
89
+ describe('toBuffer/toHex', () => {
90
+ fixtures.valid.forEach((f) => {
91
+ it('exports ' + f.description + ' (' + f.id + ')', () => {
92
+ const actual = fromRaw(f.raw, true);
93
+ assert.strictEqual(actual.toHex(), f.hex);
94
+ });
95
+
96
+ if (f.whex) {
97
+ it('exports ' + f.description + ' (' + f.id + ') as witness', () => {
98
+ const wactual = fromRaw(f.raw);
99
+ assert.strictEqual(wactual.toHex(), f.whex);
100
+ });
101
+ }
102
+ });
103
+
104
+ it('accepts target Buffer and offset parameters', () => {
105
+ const f = fixtures.valid[0];
106
+ const actual = fromRaw(f.raw);
107
+ const byteLength = actual.byteLength();
108
+
109
+ const target = Buffer.alloc(byteLength * 2);
110
+ const a = actual.toBuffer(target, 0);
111
+ const b = actual.toBuffer(target, byteLength);
112
+
113
+ assert.strictEqual(a.length, byteLength);
114
+ assert.strictEqual(b.length, byteLength);
115
+ assert.strictEqual(a.toString('hex'), f.hex);
116
+ assert.strictEqual(b.toString('hex'), f.hex);
117
+ assert.deepStrictEqual(a, b);
118
+ assert.deepStrictEqual(a, target.slice(0, byteLength));
119
+ assert.deepStrictEqual(b, target.slice(byteLength));
120
+ });
121
+ });
122
+
123
+ describe('hasWitnesses', () => {
124
+ fixtures.valid.forEach((f) => {
125
+ it('detects if the transaction has witnesses: ' + (f.whex ? 'true' : 'false'), () => {
126
+ assert.strictEqual(
127
+ Transaction.fromHex(f.whex ? f.whex : f.hex).hasWitnesses(),
128
+ !!f.whex,
129
+ );
130
+ });
131
+ });
132
+ });
133
+
134
+ describe('weight/virtualSize', () => {
135
+ it('computes virtual size', () => {
136
+ fixtures.valid.forEach((f) => {
137
+ const transaction = Transaction.fromHex(f.whex ? f.whex : f.hex);
138
+
139
+ assert.strictEqual(transaction.virtualSize(), f.virtualSize);
140
+ });
141
+ });
142
+
143
+ it('computes weight', () => {
144
+ fixtures.valid.forEach((f) => {
145
+ const transaction = Transaction.fromHex(f.whex ? f.whex : f.hex);
146
+
147
+ assert.strictEqual(transaction.weight(), f.weight);
148
+ });
149
+ });
150
+ });
151
+
152
+ describe('addInput', () => {
153
+ let prevTxHash: Buffer;
154
+ beforeEach(() => {
155
+ prevTxHash = Buffer.from(
156
+ 'ffffffff00ffff000000000000000000000000000000000000000000101010ff',
157
+ 'hex',
158
+ );
159
+ });
160
+
161
+ it('returns an index', () => {
162
+ const tx = new Transaction();
163
+ assert.strictEqual(tx.addInput(prevTxHash, 0), 0);
164
+ assert.strictEqual(tx.addInput(prevTxHash, 0), 1);
165
+ });
166
+
167
+ it('defaults to empty script, witness and 0xffffffff SEQUENCE number', () => {
168
+ const tx = new Transaction();
169
+ tx.addInput(prevTxHash, 0);
170
+
171
+ assert.strictEqual(tx.ins[0].script.length, 0);
172
+ assert.strictEqual(tx.ins[0].witness.length, 0);
173
+ assert.strictEqual(tx.ins[0].sequence, 0xffffffff);
174
+ });
175
+
176
+ fixtures.invalid.addInput.forEach((f) => {
177
+ it('throws on ' + f.exception, () => {
178
+ const tx = new Transaction();
179
+ const hash = Buffer.from(f.hash, 'hex');
180
+
181
+ assert.throws(() => {
182
+ tx.addInput(hash, f.index);
183
+ }, new RegExp(f.exception));
184
+ });
185
+ });
186
+ });
187
+
188
+ describe('addOutput', () => {
189
+ it('returns an index', () => {
190
+ const tx = new Transaction();
191
+ assert.strictEqual(tx.addOutput(Buffer.alloc(0), 0), 0);
192
+ assert.strictEqual(tx.addOutput(Buffer.alloc(0), 0), 1);
193
+ });
194
+ });
195
+
196
+ describe('clone', () => {
197
+ fixtures.valid.forEach((f) => {
198
+ let actual: Transaction;
199
+ let expected: Transaction;
200
+
201
+ beforeEach(() => {
202
+ expected = Transaction.fromHex(f.hex);
203
+ actual = expected.clone();
204
+ });
205
+
206
+ it('should have value equality', () => {
207
+ assert.deepStrictEqual(actual, expected);
208
+ });
209
+
210
+ it('should not have reference equality', () => {
211
+ assert.notStrictEqual(actual, expected);
212
+ });
213
+ });
214
+ });
215
+
216
+ describe('getHash/getId', () => {
217
+ function verify(f: any): void {
218
+ it('should return the id for ' + f.id + '(' + f.description + ')', () => {
219
+ const tx = Transaction.fromHex(f.whex || f.hex);
220
+
221
+ assert.strictEqual(tx.getHash().toString('hex'), f.hash);
222
+ assert.strictEqual(tx.getId(), f.id);
223
+ });
224
+ }
225
+
226
+ fixtures.valid.forEach(verify);
227
+ });
228
+
229
+ describe('isCoinbase', () => {
230
+ function verify(f: any): void {
231
+ it('should return ' + f.coinbase + ' for ' + f.id + '(' + f.description + ')', () => {
232
+ const tx = Transaction.fromHex(f.hex);
233
+
234
+ assert.strictEqual(tx.isCoinbase(), f.coinbase);
235
+ });
236
+ }
237
+
238
+ fixtures.valid.forEach(verify);
239
+ });
240
+
241
+ describe('hashForSignature', () => {
242
+ it('does not use Witness serialization', () => {
243
+ const randScript = Buffer.from('6a', 'hex');
244
+
245
+ const tx = new Transaction();
246
+ tx.addInput(
247
+ Buffer.from(
248
+ '0000000000000000000000000000000000000000000000000000000000000000',
249
+ 'hex',
250
+ ),
251
+ 0,
252
+ );
253
+ tx.addOutput(randScript, 5000000000);
254
+
255
+ const original = (tx as any).__toBuffer;
256
+ (tx as any).__toBuffer = function (this: Transaction, a: any, b: any, c: any): any {
257
+ if (c !== false) throw new Error('hashForSignature MUST pass false');
258
+
259
+ return original.call(this, a, b, c);
260
+ };
261
+
262
+ assert.throws(() => {
263
+ (tx as any).__toBuffer(undefined, undefined, true);
264
+ }, /hashForSignature MUST pass false/);
265
+
266
+ // assert hashForSignature does not pass false
267
+ assert.doesNotThrow(() => {
268
+ tx.hashForSignature(0, randScript, 1);
269
+ });
270
+ });
271
+
272
+ fixtures.hashForSignature.forEach((f) => {
273
+ it(
274
+ 'should return ' +
275
+ f.hash +
276
+ ' for ' +
277
+ (f.description ? 'case "' + f.description + '"' : f.script),
278
+ () => {
279
+ const tx = Transaction.fromHex(f.txHex);
280
+ const script = bscript.fromASM(f.script);
281
+
282
+ assert.strictEqual(
283
+ tx.hashForSignature(f.inIndex, script, f.type).toString('hex'),
284
+ f.hash,
285
+ );
286
+ },
287
+ );
288
+ });
289
+ });
290
+
291
+ describe('hashForWitnessV0', () => {
292
+ fixtures.hashForWitnessV0.forEach((f) => {
293
+ it(
294
+ 'should return ' +
295
+ f.hash +
296
+ ' for ' +
297
+ (f.description ? 'case "' + f.description + '"' : ''),
298
+ () => {
299
+ const tx = Transaction.fromHex(f.txHex);
300
+ const script = bscript.fromASM(f.script);
301
+
302
+ assert.strictEqual(
303
+ tx.hashForWitnessV0(f.inIndex, script, f.value, f.type).toString('hex'),
304
+ f.hash,
305
+ );
306
+ },
307
+ );
308
+ });
309
+ });
310
+
311
+ describe('taprootSigning', () => {
312
+ fixtures.taprootSigning.forEach((f) => {
313
+ const tx = Transaction.fromHex(f.txHex);
314
+ const prevOutScripts = f.utxos.map(({ scriptHex }) => Buffer.from(scriptHex, 'hex'));
315
+ const values = f.utxos.map(({ value }) => value);
316
+
317
+ f.cases.forEach((c) => {
318
+ let hash: Buffer;
319
+
320
+ it(`should hash to ${c.hash} for ${f.description}:${c.vin}`, () => {
321
+ const hashType = Buffer.from(c.typeHex, 'hex').readUInt8(0);
322
+
323
+ hash = tx.hashForWitnessV1(c.vin, prevOutScripts, values, hashType);
324
+ assert.strictEqual(hash.toString('hex'), c.hash);
325
+ });
326
+ });
327
+ });
328
+ });
329
+
330
+ describe('setWitness', () => {
331
+ it('only accepts a witness stack (Array of Buffers)', () => {
332
+ assert.throws(() => {
333
+ (new Transaction().setWitness as any)(0, 'foobar');
334
+ }, /Expected property "1" of type \[Buffer], got String "foobar"/);
335
+ });
336
+ });
337
+ });