mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
Test trimming in parseCoins
This commit is contained in:
parent
0292982f23
commit
fa0987c0ee
@ -94,6 +94,33 @@ describe("coins", () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("trims leading zeros", () => {
|
||||||
|
expect(parseCoins("07643ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "7643",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(parseCoins("007643ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "7643",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(parseCoins("0ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "0",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(parseCoins("0000ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "0",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it("ignores empty elements", () => {
|
it("ignores empty elements", () => {
|
||||||
// start
|
// start
|
||||||
expect(parseCoins(",819966000ucosm,700000000ustake")).toEqual([
|
expect(parseCoins(",819966000ucosm,700000000ustake")).toEqual([
|
||||||
|
@ -46,6 +46,33 @@ describe("coins", () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("trims leading zeros", () => {
|
||||||
|
expect(parseCoins("07643ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "7643",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(parseCoins("007643ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "7643",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(parseCoins("0ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "0",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(parseCoins("0000ureef")).toEqual([
|
||||||
|
{
|
||||||
|
amount: "0",
|
||||||
|
denom: "ureef",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it("works for two", () => {
|
it("works for two", () => {
|
||||||
expect(parseCoins("819966000ucosm,700000000ustake")).toEqual([
|
expect(parseCoins("819966000ucosm,700000000ustake")).toEqual([
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user