Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fee.ts test validation #767

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions src/lib/utils/fee.test.ts
Original file line number Diff line number Diff line change
@@ -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",
});
});
});
Loading