Skip to content

Commit

Permalink
Merge pull request #43 from LN-Zap/tests
Browse files Browse the repository at this point in the history
Run tests on ci
  • Loading branch information
mrfelton authored Feb 14, 2024
2 parents 65898a4 + 2fb1ebe commit 8dfd200
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 33 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
32 changes: 0 additions & 32 deletions test/unit.test.js

This file was deleted.

14 changes: 14 additions & 0 deletions test/unit.test.ts
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit 8dfd200

Please sign in to comment.