-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
launchpad: Update GasPrice to hold Decimal
- Loading branch information
1 parent
25d9365
commit 4ad7fa4
Showing
3 changed files
with
41 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
import { Decimal } from "@cosmjs/math"; | ||
|
||
import { GasPrice } from "./gas"; | ||
|
||
describe("GasPrice", () => { | ||
it("can be constructed", () => { | ||
const gasPrice = new GasPrice(3.14, "utest"); | ||
expect(gasPrice.amount).toEqual(3.14); | ||
expect(gasPrice.denom).toEqual("utest"); | ||
const inputs = ["3.14", "3", "0.14"]; | ||
inputs.forEach((input) => { | ||
const gasPrice = new GasPrice(Decimal.fromUserInput(input, 18), "utest"); | ||
expect(gasPrice.amount.toString()).toEqual(input); | ||
expect(gasPrice.denom).toEqual("utest"); | ||
}); | ||
}); | ||
|
||
it("can be constructed from a config string", () => { | ||
const inputs = ["3.14", "3", "0.14"]; | ||
inputs.forEach((input) => { | ||
const gasPrice = GasPrice.fromString(`${input}utest`); | ||
expect(gasPrice.amount.toString()).toEqual(input); | ||
expect(gasPrice.denom).toEqual("utest"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters