diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 95a02bd..a0b86dc 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -18,6 +18,16 @@ jobs: - name: Checkout Code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4 + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Run tests + run: bun test + - name: Dockerhub login run: "docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..bb837f6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +name: Test + +on: + push: + +jobs: + publish: + runs-on: "ubuntu-latest" + + steps: + - name: Checkout Code + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4 + + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Run tests + run: bun test diff --git a/bun.lockb b/bun.lockb index 131af4e..062d6bf 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 91c991c..551347d 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@types/config": "3.3.3", "@types/node-cache": "4.2.5", "pino-pretty": "10.3.1", - "tape": "5.7.4" + "tap": "18.7.0" }, "engines": { "node": ">=14.0.0" diff --git a/test/unit.test.js b/test/unit.test.js deleted file mode 100644 index 1827f01..0000000 --- a/test/unit.test.js +++ /dev/null @@ -1,32 +0,0 @@ -import test from "tape"; -import { addFeeEstimates } from "../src/util"; - -test("addFeeEstimates", (t) => { - t.plan(4); - - const feeByBlockTarget = { 1: 100, 2: 200, 3: 300 }; - const newEstimates = { 4: 50, 5: 150, 6: 250 }; - - addFeeEstimates(feeByBlockTarget, newEstimates); - - t.equal( - feeByBlockTarget[4], - 50, - "Should add new estimate with block target 4 and fee 50", - ); - t.equal( - feeByBlockTarget[5], - undefined, - "Should not add new estimate with block target 5 and fee 150", - ); - t.equal( - feeByBlockTarget[6], - undefined, - "Should not add new estimate with block target 6 and fee 250", - ); - t.equal( - Object.keys(feeByBlockTarget).length, - 4, - "Should add only one new estimate", - ); -}); diff --git a/test/unit.test.ts b/test/unit.test.ts new file mode 100644 index 0000000..03c57b4 --- /dev/null +++ b/test/unit.test.ts @@ -0,0 +1,14 @@ +import { expect, test } from "bun:test"; +import { addFeeEstimates } from "../src/util"; + +test("addFeeEstimates", () => { + const feeByBlockTarget: FeeByBlockTarget = { 1: 100, 2: 200, 3: 300 }; + const newEstimates: FeeByBlockTarget = { 4: 50, 5: 150, 6: 250 }; + + addFeeEstimates(feeByBlockTarget, newEstimates); + + expect(feeByBlockTarget[4]).toEqual(50); + expect(feeByBlockTarget[5]).toBeUndefined(); + expect(feeByBlockTarget[6]).toBeUndefined(); + expect(Object.keys(feeByBlockTarget).length).toEqual(4); +});