Skip to content

Commit 18a2b12

Browse files
authored
Merge pull request #311 from lightningrodlabs/add-jest
Unit tests for migration logic
2 parents b10d4bc + a10d97c commit 18a2b12

38 files changed

+18571
-12278
lines changed

.github/workflows/unit-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
unit-test:
10+
strategy:
11+
matrix:
12+
os:
13+
- ubuntu-latest
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Install nodejs dependencies
18+
run: |
19+
npm run web-install
20+
shell: bash
21+
- name: run unit tests
22+
run: |
23+
npm run web-test
24+
shell: bash

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"web3": "cd web && WEB_PORT=8083 ADMIN_WS_PORT=1103 APP_WS_PORT=8103 npx webpack-dev-server --config webpack.dev.js",
1717
"web4": "cd web && WEB_PORT=8084 ADMIN_WS_PORT=1104 APP_WS_PORT=8104 npx webpack-dev-server --config webpack.dev.js",
1818
"web-build": "cd web && npx webpack --config webpack.prod.js",
19+
"web-test": "cd web && npm run test",
1920
"electron-install": "cd electron && npm install",
2021
"electron": "cd electron && WEB_PORT=8081 ACORN_AGENT_NUM=1 npm run start",
2122
"electron2": "cd electron && WEB_PORT=8082 ACORN_AGENT_NUM=2 npm run start",

web/jest.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
extensionsToTreatAsEsm: ['.ts'],
6+
transform: {
7+
'^.+\\.[tj]s$': [
8+
'babel-jest',
9+
{
10+
presets: [
11+
[
12+
'@babel/preset-env',
13+
{
14+
targets: {
15+
node: 'current',
16+
},
17+
},
18+
],
19+
'@babel/preset-typescript',
20+
],
21+
},
22+
],
23+
},
24+
transformIgnorePatterns: [
25+
'node_modules/(?!((@holochain/(client|serialization))|@noble/ed25519|emittery|lodash-es).*)',
26+
],
27+
globals: {
28+
__MAIN_APP_ID__: 'test-main-app-id',
29+
__ADMIN_PORT__: 'test-admin-port',
30+
__APP_PORT__: 'test-app-port',
31+
},
32+
}

0 commit comments

Comments
 (0)