From c3c56216adffd45f559a14f76d897a9564112f82 Mon Sep 17 00:00:00 2001 From: Poafs1 Date: Tue, 6 Feb 2024 16:27:19 +0700 Subject: [PATCH 1/2] test(utils): add unit test for truncate util function --- src/lib/utils/truncate.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/lib/utils/truncate.test.ts 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"); + }); +}); From e1ce7133e314637f6b06fcdc6ecb8e4c6e39caac Mon Sep 17 00:00:00 2001 From: Poafs1 Date: Tue, 6 Feb 2024 16:31:43 +0700 Subject: [PATCH 2/2] docs: update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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