Move tests from MyMOneroCoreCpp.node.js to monero_utils.spec.js

pull/91/head
Guten Ye 5 years ago
parent c1c562a0ef
commit d94a4f3c04

@ -133,20 +133,6 @@ function tests(Module)
console.timeEnd("estimated_tx_network_fee")
console.log("estimated_tx_network_fee ret", ret_string)
}
{
console.time("estimate_fee")
const args = {"use_per_byte_fee": "true", "use_rct": "true", "n_inputs": "2", "mixin": "10", "n_outputs": "2","extra_size": "0", "bulletproof": "true", "base_fee": "24658", "fee_quantization_mask": "10000", "priority": "2", "fork_version": "10"}
const ret_string = Module.estimate_fee(JSON.stringify(args))
console.timeEnd("estimate_fee")
console.log("estimate_fee ret", ret_string)
}
{
console.time("estimate_tx_weight")
const args = {"use_rct": "true", "n_inputs": "2", "mixin": "10", "n_outputs": "2","extra_size": "0", "bulletproof": "true"}
const ret_string = Module.estimate_tx_weight(JSON.stringify(args))
console.timeEnd("estimate_tx_weight")
console.log("estimate_tx_weight ret", ret_string)
}
{
console.time("estimate_rct_tx_size")
const args_str = '{"n_inputs":1,"mixin":10,"n_outputs":2,"extra_size":0,"bulletproof":true}'

@ -181,5 +181,39 @@ describe("cryptonote_utils tests", function() {
"4501", // TODO: is this correct?
);
});
it("estimate_fee", async function() {
const monero_utils = await require("../monero_utils/MyMoneroCoreBridge")({})
var fee = monero_utils.estimate_fee({
use_per_byte_fee: true,
use_rct: true,
n_inputs: 2,
mixin: 10,
n_outputs: 2,
extra_size: 0,
bulletproof: true,
base_fee: 24658,
fee_quantization_mask: 10000,
priority: 2,
fork_version: 10
});
assert.equal(
fee,
330050000
);
});
it("estimate_tx_weight", async function() {
const monero_utils = await require("../monero_utils/MyMoneroCoreBridge")({})
var weight = monero_utils.estimate_tx_weight({
use_rct: true,
n_inputs: 2,
mixin: 10,
n_outputs: 2,
extra_size: 0,
bulletproof: true,
});
assert.equal(
weight,
2677
);
});
});

Loading…
Cancel
Save