diff --git a/CHANGELOG.md b/CHANGELOG.md index ca6f2a59d..07dbd4fea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/lib/utils/truncate.test.ts b/src/lib/utils/truncate.test.ts new file mode 100644 index 000000000..410d3b897 --- /dev/null +++ b/src/lib/utils/truncate.test.ts @@ -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"); + }); +});