From 92b5f7d73c1fede40ad48ddc278ebe7dabf1218e Mon Sep 17 00:00:00 2001 From: t0rbik Date: Thu, 1 Aug 2024 17:12:32 +0200 Subject: [PATCH 1/3] add unit test workflow --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..029c6b39 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +on: + pull_request: + types: [opened, reopened] + push: + +jobs: + build: + name: Tests + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.6.0 + run_install: false + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + - name: Install Dependencies + run: pnpm install + - name: Test with Vitest + run: pnpm test From 6fc7ce6b24d280f01c3deb3c5dbdc18b8fe1a58e Mon Sep 17 00:00:00 2001 From: t0rbik Date: Thu, 1 Aug 2024 17:15:39 +0200 Subject: [PATCH 2/3] only run on pr --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 029c6b39..2d199e40 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,7 @@ name: Test on: pull_request: - types: [opened, reopened] - push: + types: [opened, reopened, synchronize] jobs: build: From 94ca698cf3794f5447879ea0785f2a392da46a37 Mon Sep 17 00:00:00 2001 From: t0rbik Date: Thu, 1 Aug 2024 17:30:38 +0200 Subject: [PATCH 3/3] fix util fn --- src/utils/number.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/number.ts b/src/utils/number.ts index bec0735e..83a6e53d 100644 --- a/src/utils/number.ts +++ b/src/utils/number.ts @@ -44,5 +44,6 @@ export const sanitizeNumber = (input: string, precision?: number) => { export const formatInput = (value: string) => { if (!value) return ""; if (value === ".") return "0"; + if (value.endsWith(".")) return toString(from(value.replace(".", ""))); return toString(from(value)); };