cover the case when some chunks are "minimalOP"
This commit is contained in:
parent
bc9b5abb7c
commit
883d021117
1 changed files with 15 additions and 0 deletions
|
@ -41,6 +41,21 @@ describe('script', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('toASM', () => {
|
||||||
|
const OP_RETURN = bscript.OPS.OP_RETURN;
|
||||||
|
it('encodes empty buffer as OP_0', () => {
|
||||||
|
const chunks = [OP_RETURN, Buffer.from([])];
|
||||||
|
assert.strictEqual(bscript.toASM(chunks), 'OP_RETURN OP_0');
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 1; i <= 16; i++) {
|
||||||
|
it(`encodes one byte buffer [${i}] as OP_${i}`, () => {
|
||||||
|
const chunks = [OP_RETURN, Buffer.from([i])];
|
||||||
|
assert.strictEqual(bscript.toASM(chunks), 'OP_RETURN OP_' + i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
describe('fromASM/toASM (templates)', () => {
|
describe('fromASM/toASM (templates)', () => {
|
||||||
fixtures2.valid.forEach(f => {
|
fixtures2.valid.forEach(f => {
|
||||||
if (f.inputHex) {
|
if (f.inputHex) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue