Skip to content

Commit a46ceec

Browse files
committed
test: Dash.getNextSuperblock()
1 parent 76cbe02 commit a46ceec

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/calc-next-superblock.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use strict";
2+
3+
let DashGov = require("../");
4+
5+
let tests = [
6+
[
7+
2115106 - DashGov.SUPERBLOCK_INTERVAL,
8+
2126848 - DashGov.SUPERBLOCK_INTERVAL,
9+
],
10+
[2115106, 2126848],
11+
[2126847, 2126848],
12+
[2126848, 2126848 + DashGov.SUPERBLOCK_INTERVAL],
13+
[2126849, 2126848 + DashGov.SUPERBLOCK_INTERVAL],
14+
];
15+
16+
for (let test of tests) {
17+
let height = test[0];
18+
let expected = test[1];
19+
20+
let superblock = DashGov.getNextSuperblock(height);
21+
if (superblock !== expected) {
22+
throw new Error(
23+
`expected superblock for height ${height} to be ${expected}, but got ${superblock}`,
24+
);
25+
}
26+
}
27+
28+
console.info(`PASS: DashGov.getNextSuperblock(height)`);

0 commit comments

Comments
 (0)