Fix: Create BigNumber with NaN value in Dish.valid

The constructor expects the default value but we are not passing it.
So it was throwing undefined error. Now passing NaN as default value.
This commit is contained in:
Sivachandran Paramasivam 2026-06-17 16:59:47 +05:30
parent 65f47c0343
commit 8feb412901
2 changed files with 5 additions and 2 deletions

View File

@ -292,7 +292,7 @@ class Dish {
and reinitialise it as a BigNumber object. and reinitialise it as a BigNumber object.
*/ */
if (Object.keys(this.value).sort().equals(["c", "e", "s"])) { if (Object.keys(this.value).sort().equals(["c", "e", "s"])) {
const temp = new BigNumber(); const temp = new BigNumber(NaN);
temp.c = this.value.c; temp.c = this.value.c;
temp.e = this.value.e; temp.e = this.value.e;
temp.s = this.value.s; temp.s = this.value.s;

View File

@ -8,5 +8,8 @@ TestRegister.addApiTests([
const dish = new Dish(); const dish = new Dish();
assert(dish.presentAs); assert(dish.presentAs);
}), }),
it("Disk - valid: should not err on serialized big_number", () => {
const dish = new Dish({ c: 0, e: 0, s: 0 }, Dish.BIG_NUMBER);
assert(dish.valid());
})
]); ]);