Skip to content

Commit

Permalink
Merge pull request #768 from alleslabs/feature/cfe-330-truncate-unit-…
Browse files Browse the repository at this point in the history
…test

Feature/cfe 330 truncate unit test
  • Loading branch information
evilpeach committed Feb 6, 2024
2 parents 9f721b1 + e1ce713 commit f14283a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ 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
- [#768](https://github.com/alleslabs/celatone-frontend/pull/768) Add unit test for truncate.test.ts
- [#767](https://github.com/alleslabs/celatone-frontend/pull/767) Add unit test for fee.test.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
18 changes: 18 additions & 0 deletions src/lib/utils/truncate.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { truncate } from "./truncate";

describe("truncate validation", () => {
test("standard case", () => {
const result = truncate("osmo102cykl9ng6m9e7ytku25r632shfdk3ux4eayz4");

expect(result).toBe("osmo10...4eayz4");
});

test("custom head and tail length", () => {
const result = truncate(
"osmo102cykl9ng6m9e7ytku25r632shfdk3ux4eayz4",
[10, 4]
);

expect(result).toBe("osmo102cyk...ayz4");
});
});

0 comments on commit f14283a

Please sign in to comment.