This repository has been archived on 2023-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
2020-11-28 19:52:32 +00:00
|
|
|
import {expect} from "chai";
|
|
|
|
import {hexToBytes, bytesToHex} from "../../../src/helpers/hex";
|
2020-12-03 00:06:36 +00:00
|
|
|
import {hexToBytesNode} from "../../util";
|
2020-11-28 19:52:32 +00:00
|
|
|
|
|
|
|
describe("helpers / hex", () => {
|
|
|
|
const testCases: {id: string; hex: string}[] = [
|
|
|
|
{
|
|
|
|
id: "pubkey",
|
|
|
|
hex: "0xb6f21199594b56d77670564bf422cb331d5281ca2c1f9a45588a56881d8287ef8619efa6456d6cd2ef61306aa5b21311",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
for (const {id, hex} of testCases) {
|
|
|
|
it(`${id} hexToBytes`, () => {
|
|
|
|
const expectedBytes = hexToBytesNode(hex);
|
|
|
|
const bytes = hexToBytes(hex);
|
|
|
|
expect(expectedBytes.equals(bytes)).to.be.true;
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`${id} bytesToHex`, () => {
|
|
|
|
const bytes = hexToBytesNode(hex);
|
|
|
|
const _hex = bytesToHex(bytes);
|
|
|
|
expect(_hex).to.equal(hex);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|