Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/lit 2921 js sdk migrate to jest #549

Open
wants to merge 152 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
53ffb2c
feat(test): setup jest testing environment
Ansonhkg Apr 16, 2024
471b167
chore: update test command
Ansonhkg Apr 16, 2024
40b54bb
chore: prettified
Ansonhkg Apr 16, 2024
73111bd
fix(e2e-tests): Use Jest for example e2e tests, using `runInBand` con…
MaximusHaximus Apr 25, 2024
cc64a2d
fix(e2e-tests): Use test.each() to describe multiple test cases in a …
MaximusHaximus Apr 25, 2024
de240c9
dev: upgrade tests to use Tinny and fix TSC errors
Jul 18, 2024
be46a13
dev: add dotenv loading in setup
Jul 19, 2024
b0d9d99
dev: wip test migration
Jul 19, 2024
33573cc
ref: refactor test run command
Jul 19, 2024
87b6ed9
ref: remove invalid config option
Jul 19, 2024
fb17f72
dev: Migrate tests wip
Jul 19, 2024
1bff386
ci: remove filter flags wip
Jul 19, 2024
1a24a58
ref: refactor env pathing
Jul 22, 2024
7737f4c
chore: fmt
Jul 22, 2024
b64e39b
test: wip porting local-tests to jest
Jul 22, 2024
6faca67
ref: refactor tests for explicit test cases over iterator
Jul 23, 2024
e51fa27
Merge branch 'feat-datil-dev-yellowstone' of github.com:LIT-Protocol/…
Jul 23, 2024
ff8559c
ref: tweaks to test cases after refactor
Jul 23, 2024
a38d6a2
test: migrate wrapped keys tests
Jul 23, 2024
0dca2ea
ref: Migrate to explicit test cases
Jul 23, 2024
506ec01
test: add delegation tests
Jul 23, 2024
10779fe
chore: version bump
Jul 23, 2024
57c1857
ref: add back dep
Jul 23, 2024
57005ef
ref: refactor to explicit test cases
Jul 23, 2024
755f819
ref: change null to undefnied
Jul 23, 2024
7120a71
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Jul 23, 2024
84af687
test: add in action combine tests
Jul 23, 2024
e5989d2
ci: add filter flag for test suite
Jul 23, 2024
f2840d2
ref: up test timeout
Jul 23, 2024
27dbea4
dev: Move Tinny to package
Jul 24, 2024
d1bd379
chore: package updates for jest (dev deps)
Jul 24, 2024
9b77385
ref: run tests parallel
Jul 24, 2024
3f63560
ref: remove session generators
Jul 24, 2024
ebe2f65
dev: update imports for tinny package
Jul 24, 2024
ca39af6
ref: add back yellow stone config
Jul 24, 2024
67da99a
docs: Add comment on pathing import
Jul 24, 2024
c962448
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Jul 24, 2024
bb1ee3c
dev: formatting and ts ignore for formally incompatible types.
Jul 24, 2024
5b36051
ref: change TS version back to 4.x.x
Jul 24, 2024
cf59162
ref: revert package file changes
Jul 24, 2024
4063ceb
chore: upgrade `contracts` package to `0.0.39`
Ansonhkg Jul 24, 2024
df82e41
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Jul 25, 2024
bb98694
chore: bump package version
Jul 25, 2024
3725969
ref: Fix type errors
Jul 25, 2024
305adaa
ref: test updates
Jul 25, 2024
7967d23
test: add timeout
Jul 25, 2024
432a2d2
ci: add explicit runners per test desc for now
Jul 25, 2024
fc76bda
ref: fix string literals
Jul 25, 2024
92e78af
chore: fmt
Jul 25, 2024
4e88606
ci: add run conditions
Jul 26, 2024
6de4c0b
dev: refactor wrapped keys tests
Jul 26, 2024
229b240
dev: add disconect calls in connect tests
Jul 26, 2024
a8e6be6
chore: sync package version
Jul 26, 2024
2301143
ref: cleanup
Jul 26, 2024
d2b41d1
chore: fmt
Jul 26, 2024
fa46163
dev: update setup for tinny
Jul 29, 2024
5569d37
dev: merge 'master'
Jul 29, 2024
8e6a523
dev: add network key to contract sdk init
Jul 29, 2024
413f999
ref: refactor contract context
Jul 29, 2024
fa0a968
dev: update jest hooks
Jul 29, 2024
2e69648
chore: fmt
Jul 29, 2024
ea5ef28
ref: Change import per jest docs
Jul 29, 2024
f13f07c
ref: aggregate Lti Action testing
Jul 30, 2024
22eb303
ref: move to explicit options
Jul 30, 2024
15d1299
chore: fmt
Jul 30, 2024
6d211b9
ref: remove test step
Jul 30, 2024
bcbf810
ref: fix test
Jul 30, 2024
1efe7a0
ref: change jest test runner
Jul 30, 2024
4387c4c
ci: change test run comand in ci for jest
Jul 30, 2024
6b06cc8
ref: change readme for new test runner
Jul 30, 2024
b17f63e
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Aug 7, 2024
66318e0
add scope to e2e tests
Aug 7, 2024
6c5fec6
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Aug 12, 2024
4e11c41
chore: update versions
Aug 12, 2024
d5f60ae
dev: update per review comments
Aug 12, 2024
4906a88
dev: update connection tests
Aug 12, 2024
e1ffd6c
dev: update tinny
Aug 12, 2024
6950c4e
ref: fix tsc errors
Aug 12, 2024
3959b1b
dev: ass eslint config and fix errors
Aug 12, 2024
84c02db
ref: use absolute import for export error
Aug 12, 2024
a238082
ref: cleanup and remove ipfs import
Aug 12, 2024
8bebfa1
ref: update localchain constant
Aug 12, 2024
709cced
chore: update env ci vals
Aug 12, 2024
5f345c7
ref: remove semicolon
Aug 12, 2024
1dabf5d
ref: update connection tests lifecycle
Aug 12, 2024
ab2b0b0
ref: switch to global devenv
Aug 12, 2024
3aba024
dep: add jest-enviroment-jsdom
Aug 13, 2024
39dfd56
chore: update lock file
Aug 13, 2024
4d1af2b
formatting and pr comments
Aug 13, 2024
14c4d90
ref: use expect over explicit check
Aug 13, 2024
d77b399
dev: Run eslint
Aug 13, 2024
215f4cf
ref: add ignore for undefined checks
Aug 13, 2024
34ac830
fix eslint ignores
Aug 13, 2024
6a2466c
ref: cleanup
Aug 13, 2024
7a66d3a
ref: tweaks for multiple jest standup ops in ci
Aug 13, 2024
493bf51
ref: add flag for tinny setup
Aug 19, 2024
68de37f
ci: add sync flag
Aug 19, 2024
e3f9720
dev: add key rlease to ethers and module caching
Aug 19, 2024
086308e
tests: release keys for pkp ethers tests
Aug 19, 2024
1ded6f9
ci: upgrade unit test
Aug 19, 2024
b3be546
ci: change test ci runner
Aug 19, 2024
b6568c4
ci: update unit test runner
Aug 19, 2024
32ba03b
ci: fix unit test runner
Aug 20, 2024
47f3bbd
ref: fix unit tests
Aug 20, 2024
e5a9294
ref: fmt
Aug 20, 2024
9e3bd1a
ref: fix ts-expect
Aug 20, 2024
05d2269
ref: refactor blocking calls for formatting
Aug 20, 2024
601aaf5
test: add mocks for console logging in logger spec
Aug 21, 2024
83fde6b
dev: remove tinny from e2e tests
Aug 21, 2024
5dc7874
test: move to lifecycle key management for TinnyPersons
Aug 21, 2024
b9d4487
test: refactor test user life cycle
Aug 21, 2024
ff35a3a
test: review comments
Aug 21, 2024
384bee5
test: test wrapping test cases in support network checks
Aug 21, 2024
47bec27
test: fix network check
Aug 22, 2024
1e6be9b
test: review comment updates
Aug 22, 2024
fc5a222
ci: remove install flags
Aug 22, 2024
867f5ee
chore: fmt
Aug 22, 2024
70bf215
ref: remove code coverage flag
Aug 22, 2024
a27b589
ref: add more test assertions
Aug 22, 2024
cb83f37
chore: remove `local-tests` directory
Aug 22, 2024
fea1450
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Aug 22, 2024
a928974
chore: remove local test command
Aug 22, 2024
b66d228
chore: make tinny private
Aug 22, 2024
7ff7925
config: exclude tinny and e2e tests from release
Aug 22, 2024
41e2414
Merge branch 'master' into feature/lit-2921-js-sdk-migrate-to-jest
Ansonhkg Aug 26, 2024
47d4216
Update packages/e2e-tests/setup.config.js
Ansonhkg Aug 26, 2024
088cae1
Update packages/e2e-tests/src/tests/Delegation.spec.ts
Ansonhkg Aug 26, 2024
81b7667
fix: oops sorry reverted, didn't realise it's a .js file
Ansonhkg Aug 26, 2024
aae05df
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Sep 6, 2024
d16bd26
ref: changes per PR comments
Sep 9, 2024
d5d9e56
ref: remove message set in custom error constructor
Sep 9, 2024
110b011
docs: update comment on rpc
Sep 9, 2024
50c781f
ref: refactor RLI mintnig methods
Sep 9, 2024
659203b
dev: revert change to explict preset options to use nx presets with e…
Sep 9, 2024
291ec89
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Sep 18, 2024
fa276b7
Merge branch 'feature/lit-2921-js-sdk-migrate-to-jest' of github.com:…
Sep 18, 2024
81888bd
test: fix property error in logger test
Sep 18, 2024
0307a30
test: update logger test case
Sep 18, 2024
1e53e0f
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Sep 23, 2024
663ac03
chore: fmt
Sep 23, 2024
b0ef22a
ci: add missing container steps
Sep 23, 2024
c17d4d8
ref: type updates for session signatures
Sep 24, 2024
03255cc
ci: add rpc url
Sep 24, 2024
de2ce15
ref: add network context
Sep 24, 2024
84e8dd8
dev: upgrade tests to use Tinny and fix TSC errors
Jul 18, 2024
572fc98
dev: add dotenv loading in setup
Jul 19, 2024
8eafb70
dev: wip test migration
Jul 19, 2024
0aafdce
test: fix logging unit test
Oct 14, 2024
2db382c
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Oct 16, 2024
00e8e74
ref: fix import
Oct 16, 2024
b644ec0
chore: update package versions
Oct 16, 2024
f595894
chore: fmt
Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tinny ENV Vars
MAX_ATTEMTPS=1
NETWORK=localchain
NETWORK=custom
DEBUG=true
WAIT_FOR_KEY_INTERVAL=3000
TIME_TO_RELEASE_KEY=10000
Expand All @@ -10,6 +10,7 @@ NO_SETUP=false
USE_SHIVA=true
NETWORK_CONFIG=./networkContext.json
TEST_TIMEOUT=45000
LIT_RPC_URL=http://127.0.0.1:8545

#Shiva Client ENV Vars
STOP_TESTNET=false
Expand Down
49 changes: 30 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'yarn'
- name: Install project dependencies
run: yarn --frozen-lockfile
- uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'master'
- uses: actions/checkout@v3
- name: Use Node.js
uses: buildjet/setup-node@v3
with:
node-version: 20
cache: yarn
cache-dependency-path: ${{ github.workspace }}/yarn.lock
- name: Install Dependencies
run: yarn
- name: Build
run: yarn build:dev
- name: Run Unit tests
run: yarn tools --test --unit
run: yarn test:ci
integration-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand All @@ -57,7 +59,13 @@ jobs:
rust/lit-node
- name: Check LA dir
run: ls -la ${{github.workspace}}/lit-assets
- name: Install LA Blockchain Dependencies
- name: Setup Lit Bockchain Dependencies
uses: buildjet/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: ${{ github.workspace }}/lit-assets/blockchain/contracts/package-lock.json
- name: Install Blockchain Deps
run: npm i
working-directory: ${{github.workspace}}/lit-assets/blockchain/contracts
- name: Docker login
Expand All @@ -69,12 +77,8 @@ jobs:
- name: Run Shiva Container
id: shiva-runner
run: docker run -d -m 32g -p 8000:8000 -p 8545:8545 -p 7470:7470 -p 7471:7471 -p 7472:7472 -p 7473:7473 -p 7474:7474 -p 7475:7475 -v ${{github.workspace}}/lit-assets:/data -e GH_PAT=${{secrets.GH_PAT}} -e HASH=$DATIL_COMMIT_HASH -e IPFS_API_KEY=${{secrets.IPFS_API_KEY}} --name shiva ghcr.io/lit-protocol/shiva:latest
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install project dependencies
run: yarn --frozen-lockfile
run: yarn
- uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'master'
Expand All @@ -83,16 +87,23 @@ jobs:
run: yarn build:dev
- name: Copy ENV File
run: cp .env.ci .env
- name: Run End to End Tests
- name: End to End Tests - Connection
id: connection
if: steps.build.outputs.exit_code == 0
run: yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning,testUseEoaSessionSigsToPkpSign,testUsePkpSessionSigsToExecuteJsSigning,testUsePkpSessionSigsToPkpSign,testUseValidLitActionCodeGeneratedSessionSigsToPkpSign,testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning,testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs,testEthAuthSigToEncryptDecryptString,testExecuteJsSignAndCombineEcdsa,testExecutJsDecryptAndCombine,testExecuteJsBroadcastAndCollect --exclude=Parallel
run: yarn test:e2e -t 'Connections'
- name: End Tests Session Compaitiblity
joshLong145 marked this conversation as resolved.
Show resolved Hide resolved
id: session
if: steps.connection.outputs.exit_code == 0
run: yarn test:e2e -t 'SessionSigs'
- name: End to End Tests - PKP Ethers
if: steps.session.outputs.exit_code == 0
id: pkp
run: yarn test:e2e -t 'PKP Ethers'
- name: Get Container Logs
if: always()
run: docker logs shiva
- name: Post Pull Shiva Container
id: container-stop
if: steps.shiva-pull.outputs.exit_code == 0
run: docker stop shiva && docker rm shiva
- name: Post Pull Shiva Image
if: steps.shiva-pull.outputs.exit_code == 0
run: docker rmi ghcr.io/lit-protocol/shiva

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ If you're a tech-savvy user and wish to utilize only specific submodules that ou
| [@lit-protocol/contracts-sdk](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/contracts-sdk) | ![contracts-sdk](https://img.shields.io/badge/-universal-8A6496 'contracts-sdk') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/contracts-sdk"><img src="https://img.shields.io/npm/v/@lit-protocol/contracts-sdk"/></a> |
| [@lit-protocol/core](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/core) | ![core](https://img.shields.io/badge/-universal-8A6496 'core') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/core"><img src="https://img.shields.io/npm/v/@lit-protocol/core"/></a> |
| [@lit-protocol/crypto](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/crypto) | ![crypto](https://img.shields.io/badge/-universal-8A6496 'crypto') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/crypto"><img src="https://img.shields.io/npm/v/@lit-protocol/crypto"/></a> |
| [@lit-protocol/e2e-tests](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/e2e-tests) | ![e2e-tests](https://img.shields.io/badge/-universal-8A6496 'e2e-tests') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/e2e-tests"><img src="https://img.shields.io/npm/v/@lit-protocol/e2e-tests"/></a> |
| [@lit-protocol/ecdsa-sdk](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/ecdsa-sdk) | ![ecdsa-sdk](https://img.shields.io/badge/-universal-8A6496 'ecdsa-sdk') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/ecdsa-sdk"><img src="https://img.shields.io/npm/v/@lit-protocol/ecdsa-sdk"/></a> |
| [@lit-protocol/encryption](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/encryption) | ![encryption](https://img.shields.io/badge/-universal-8A6496 'encryption') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/encryption"><img src="https://img.shields.io/npm/v/@lit-protocol/encryption"/></a> |
| [@lit-protocol/logger](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/logger) | ![logger](https://img.shields.io/badge/-universal-8A6496 'logger') | <a target="_blank" href="https://www.npmjs.com/package/@lit-protocol/logger"><img src="https://img.shields.io/npm/v/@lit-protocol/logger"/></a> |
Expand Down Expand Up @@ -131,14 +132,14 @@ yarn build

## Run unit tests

```
```sh
yarn test:unit
```

## Run E2E tests in nodejs

```
yarn test:local
```sh
yarn test:e2e
```

# Advanced
Expand Down
10 changes: 9 additions & 1 deletion jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Direct link to nx presets
* https://github.com/nrwl/nx/blob/master/packages/jest/preset/jest-preset.ts
*/
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
const presets = {
...nxPreset,
};

presets.testEnviorment = 'node';
2 changes: 2 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('dotenv').config({ path: '../../.env' });
console.log('loaded configuration from .env');
const crypto = require('crypto');

global.TextEncoder = require('util').TextEncoder;
Expand Down
142 changes: 0 additions & 142 deletions local-tests/README.md

This file was deleted.

Loading
Loading