Skip to content

Commit c4046b8

Browse files
test(blockchain-utils): increase unit tests coverage (#1288)
* Test format * Empty * style: resolve style guide violations [ci-lint-fix]
1 parent 0c0064b commit c4046b8

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

packages/blockchain-utils/source/format.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Contracts } from "@mainsail/contracts";
1010
describe<{
1111
app: Application;
1212
configuration: Contracts.Crypto.Configuration;
13-
}>("formatCurrency", ({ assert, beforeEach, it }) => {
13+
}>("formatCurrency", ({ assert, beforeEach, it, each }) => {
1414
beforeEach(async (context) => {
1515
context.app = new Application();
1616
context.app.get<Contracts.Kernel.Repository>(Identifiers.Config.Repository).set("crypto", crypto);
@@ -27,4 +27,15 @@ describe<{
2727
assert.equal(formatCurrency(configuration, BigInt(1e18)), "1 TѦ");
2828
assert.equal(formatCurrency(configuration, BigInt(1e18) * 100n), "100 TѦ");
2929
});
30+
31+
each(
32+
"should throw if decimals are invalid",
33+
({ dataset: data, context: { configuration } }) => {
34+
const milestones = configuration.getMilestones();
35+
milestones[0].satoshi.decimals = data;
36+
configuration.set("milestones", milestones);
37+
assert.throws(() => formatCurrency(configuration, 1n), "Invalid decimals");
38+
},
39+
[21, 100],
40+
);
3041
});

0 commit comments

Comments
 (0)