diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b0b1e4f7..9ff356795 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Improvements +- [#767](https://github.com/alleslabs/celatone-frontend/pull/767) Add test validation for Fee.ts - [#756](https://github.com/alleslabs/celatone-frontend/pull/756) Redirect usei to homepage - [#750](https://github.com/alleslabs/celatone-frontend/pull/750) api v1 - recent codes list - [#752](https://github.com/alleslabs/celatone-frontend/pull/752) Support contract state's key as base64 diff --git a/src/lib/utils/fee.test.ts b/src/lib/utils/fee.test.ts new file mode 100644 index 000000000..01c950d14 --- /dev/null +++ b/src/lib/utils/fee.test.ts @@ -0,0 +1,30 @@ +import { feeFromStr } from "./fee"; + +describe("fee validation", () => { + test("standard case", () => { + const fee = feeFromStr("10000uosmo"); + + expect(fee).toEqual({ + amount: [{ denom: "uosmo", amount: "10000" }], + gas: "0", + }); + }); + + test("undefined input handling", () => { + const fee = feeFromStr(undefined); + + expect(fee).toBeUndefined(); + }); + + test("multiple coin types", () => { + const fee = feeFromStr("10000uosmo,89999ustake"); + + expect(fee).toEqual({ + amount: [ + { denom: "uosmo", amount: "10000" }, + { denom: "ustake", amount: "89999" }, + ], + gas: "0", + }); + }); +});