Skip to content

Commit 5069c86

Browse files
authored
Add some unit tests (#9)
1 parent 3a54290 commit 5069c86

107 files changed

Lines changed: 6496 additions & 4 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/unit-test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Unit Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
inputs:
9+
node-version:
10+
description: 'Node.js version'
11+
required: true
12+
type: choice
13+
default: 'all'
14+
options:
15+
- 'all'
16+
- '20'
17+
- '22'
18+
- '24'
19+
20+
jobs:
21+
unit-test:
22+
name: Unit Test (Node.js v${{ matrix.node-version }})
23+
runs-on: ubuntu-latest
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
node-version: ${{ (github.event.inputs.node-version == 'all' || github.event.inputs.node-version == '') && fromJSON('[20, 22, 24]') || fromJSON(format('[{0}]', github.event.inputs.node-version)) }}
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Node.js ${{ matrix.node-version }}
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ matrix.node-version }}
38+
cache: 'npm'
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
- name: Build
44+
run: npm run build || true # we currently have type errors so just ignore that
45+
46+
- name: Setup Harper
47+
env:
48+
DEFAULTS_MODE: 'dev'
49+
HDB_ADMIN_USERNAME: 'admin'
50+
HDB_ADMIN_PASSWORD: 'password'
51+
ROOTPATH: '/tmp/hdb'
52+
NODE_HOSTNAME: 'localhost'
53+
run: node --enable-source-maps ./dist/bin/harperdb.js install
54+
55+
- name: Run tests
56+
run: npm run test:unit

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)