Skip to content

Commit 0929d70

Browse files
authored
feat: add test setup (#2)
* feat: add tests * add pnpm * pnpm fix * cleanup
1 parent 69e1233 commit 0929d70

19 files changed

+9950
-15
lines changed

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run SDK Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v3
16+
17+
- name: Set up pnpm
18+
uses: pnpm/action-setup@v2
19+
with:
20+
version: 8
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '20'
26+
cache: 'pnpm'
27+
28+
- name: Install SDK deps
29+
run: pnpm --filter @mintlayer/sdk install
30+
31+
- name: Run SDK tests
32+
run: pnpm --filter @mintlayer/sdk run test

packages/sdk/jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// jest.config.js
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'jsdom',
5+
setupFiles: ['<rootDir>/jest.setup.ts'],
6+
moduleNameMapper: {
7+
'^@mintlayer/wasm-lib$': '<rootDir>/tests/__mocks__/@mintlayer/wasm-lib.ts',
8+
},
9+
};

packages/sdk/jest.setup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import fetchMock from 'jest-fetch-mock';
2+
import 'whatwg-fetch';
3+
fetchMock.enableMocks();

0 commit comments

Comments
 (0)