Move tests to TypeScript (coverage is still JS based)
This commit is contained in:
parent
11e4a12caf
commit
6c08a0be40
41 changed files with 3920 additions and 2712 deletions
|
@ -1,26 +1,26 @@
|
|||
const { describe, it } = require('mocha')
|
||||
const assert = require('assert')
|
||||
const scriptNumber = require('../src/script_number')
|
||||
const fixtures = require('./fixtures/script_number.json')
|
||||
import * as assert from 'assert';
|
||||
import { describe, it } from 'mocha';
|
||||
import * as scriptNumber from '../src/script_number';
|
||||
import * as fixtures from './fixtures/script_number.json';
|
||||
|
||||
describe('script-number', () => {
|
||||
describe('decode', () => {
|
||||
fixtures.forEach(f => {
|
||||
it(f.hex + ' returns ' + f.number, () => {
|
||||
const actual = scriptNumber.decode(Buffer.from(f.hex, 'hex'), f.bytes)
|
||||
const actual = scriptNumber.decode(Buffer.from(f.hex, 'hex'), f.bytes);
|
||||
|
||||
assert.strictEqual(actual, f.number)
|
||||
})
|
||||
})
|
||||
})
|
||||
assert.strictEqual(actual, f.number);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('encode', () => {
|
||||
fixtures.forEach(f => {
|
||||
it(f.number + ' returns ' + f.hex, () => {
|
||||
const actual = scriptNumber.encode(f.number)
|
||||
const actual = scriptNumber.encode(f.number);
|
||||
|
||||
assert.strictEqual(actual.toString('hex'), f.hex)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
assert.strictEqual(actual.toString('hex'), f.hex);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue