From e1e29f2f21c1e4cf1a2b8f144b1a9223bdf4b871 Mon Sep 17 00:00:00 2001 From: Jordan Gensler Date: Tue, 13 Sep 2022 15:34:18 -0700 Subject: [PATCH] [ts-sdk] Add e2e localnet tests (#4605) * Add localnet tests for ts sdk * Fix build * Fix TS SDK run * Fix tests --- .github/workflows/explorer-client-prs.yml | 2 +- .github/workflows/ts-sdk.yml | 23 ++++- pnpm-lock.yaml | 34 +++++++ sdk/typescript/package.json | 9 +- sdk/typescript/test/e2e/example.test.ts | 6 ++ .../cryptography/ed25519-keypair.test.ts | 2 +- .../cryptography/ed25519-publickey.test.ts | 98 +++++-------------- .../cryptography/secp256k1-keypair.test.ts | 18 ++-- .../cryptography/secp256k1-publickey.test.ts | 29 ++++-- .../test/{ => unit}/mocks/rpc-http.ts | 0 .../test/{ => unit}/rpc/client.test.ts | 6 +- .../{ => unit}/signers/raw-signer.test.ts | 9 +- .../test/{ => unit}/types/framework.test.ts | 2 +- .../test/{ => unit}/types/objects.test.ts | 2 +- .../test/{ => unit}/types/stringTypes.test.ts | 4 +- .../{ => unit}/types/transactions.test.ts | 2 +- sdk/typescript/vitest.config.ts | 2 + 17 files changed, 145 insertions(+), 103 deletions(-) create mode 100644 sdk/typescript/test/e2e/example.test.ts rename sdk/typescript/test/{ => unit}/cryptography/ed25519-keypair.test.ts (97%) rename sdk/typescript/test/{ => unit}/cryptography/ed25519-publickey.test.ts (64%) rename sdk/typescript/test/{ => unit}/cryptography/secp256k1-keypair.test.ts (85%) rename sdk/typescript/test/{ => unit}/cryptography/secp256k1-publickey.test.ts (73%) rename sdk/typescript/test/{ => unit}/mocks/rpc-http.ts (100%) rename sdk/typescript/test/{ => unit}/rpc/client.test.ts (94%) rename sdk/typescript/test/{ => unit}/signers/raw-signer.test.ts (89%) rename sdk/typescript/test/{ => unit}/types/framework.test.ts (89%) rename sdk/typescript/test/{ => unit}/types/objects.test.ts (88%) rename sdk/typescript/test/{ => unit}/types/stringTypes.test.ts (96%) rename sdk/typescript/test/{ => unit}/types/transactions.test.ts (91%) diff --git a/.github/workflows/explorer-client-prs.yml b/.github/workflows/explorer-client-prs.yml index 5a20ac726d85f..80ae56a4a98b2 100644 --- a/.github/workflows/explorer-client-prs.yml +++ b/.github/workflows/explorer-client-prs.yml @@ -86,7 +86,7 @@ jobs: uses: cypress-io/github-action@v4 with: install: false - start: pnpm dlx concurrently 'cargo run --bin sui-test-validator' 'pnpm dev:local' + start: pnpm dlx concurrently --kill-others 'cargo run --bin sui-test-validator' 'pnpm dev:local' working-directory: ./explorer/client spec: cypress/e2e/localnet/* # Wait on faucet and explorer: diff --git a/.github/workflows/ts-sdk.yml b/.github/workflows/ts-sdk.yml index 88d3fd6a70fc1..c59e84573da72 100644 --- a/.github/workflows/ts-sdk.yml +++ b/.github/workflows/ts-sdk.yml @@ -29,6 +29,27 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - name: Test - run: pnpm --filter @mysten/sui.js test + run: pnpm --filter @mysten/sui.js test:unit - name: Build run: pnpm --filter @mysten/sui.js build + end_to_end: + name: End-to-end tests + needs: diff + if: needs.diff.outputs.isTypescriptSDK == 'true' + runs-on: [ubuntu-ghcloud] + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + - uses: pnpm/action-setup@v2.2.2 + with: + version: 7 + - run: cargo build --bin sui-test-validator --profile dev + - name: Install Nodejs + uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "pnpm" + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Run e2e tests + run: pnpm dlx concurrently --kill-others --success command-1 'cargo run --bin sui-test-validator' 'pnpm --filter @mysten/sui.js test:e2e' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33a3455fbe7ef..b391aef74b215 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -150,6 +150,7 @@ importers: typedoc: ^0.23.11 typescript: ^4.8.2 vitest: ^0.22.1 + wait-on: ^6.0.1 dependencies: '@mysten/bcs': link:bcs '@noble/hashes': 1.1.2 @@ -182,6 +183,7 @@ importers: typedoc: 0.23.11_typescript@4.8.2 typescript: 4.8.2 vitest: 0.22.1 + wait-on: 6.0.1 sdk/typescript/bcs: specifiers: @@ -4999,6 +5001,14 @@ packages: - debug dev: true + /axios/0.25.0: + resolution: {integrity: sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==} + dependencies: + follow-redirects: 1.15.1 + transitivePeerDependencies: + - debug + dev: true + /axios/0.27.2: resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} dependencies: @@ -8201,6 +8211,16 @@ packages: engines: {node: '>=8.9.0'} dev: true + /follow-redirects/1.15.1: + resolution: {integrity: sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: true + /follow-redirects/1.15.1_debug@4.3.2: resolution: {integrity: sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==} engines: {node: '>=4.0'} @@ -14953,6 +14973,20 @@ packages: - debug dev: true + /wait-on/6.0.1: + resolution: {integrity: sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw==} + engines: {node: '>=10.0.0'} + hasBin: true + dependencies: + axios: 0.25.0 + joi: 17.6.0 + lodash: 4.17.21 + minimist: 1.2.6 + rxjs: 7.5.6 + transitivePeerDependencies: + - debug + dev: true + /watchpack/2.4.0: resolution: {integrity: sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==} engines: {node: '>=10.13.0'} diff --git a/sdk/typescript/package.json b/sdk/typescript/package.json index 4570b014cd5f2..eec64fa0866a1 100644 --- a/sdk/typescript/package.json +++ b/sdk/typescript/package.json @@ -24,7 +24,9 @@ "build": "node ./type_guards.mjs && pnpm build:types && tsup ./src/index.ts --format esm,cjs --sourcemap", "build:types": "tsc --build", "doc": "typedoc", - "test": "vitest", + "test": "pnpm test:unit && pnpm test:e2e", + "test:unit": "vitest unit", + "test:e2e": "wait-on http://127.0.0.1:9123 -l --timeout 120000 && vitest e2e", "lint": "eslint './{src,test}/**.{ts,js}'", "prepublishOnly": "pnpm build", "size": "size-limit", @@ -76,7 +78,8 @@ "tsup": "^6.2.2", "typedoc": "^0.23.11", "typescript": "^4.8.2", - "vitest": "^0.22.1" + "vitest": "^0.22.1", + "wait-on": "^6.0.1" }, "dependencies": { "@mysten/bcs": "workspace:*", @@ -86,9 +89,9 @@ "buffer": "^6.0.3", "cross-fetch": "^3.1.5", "jayson": "^3.6.6", - "rpc-websockets": "^7.5.0", "js-sha3": "^0.8.0", "lossless-json": "^1.0.5", + "rpc-websockets": "^7.5.0", "tweetnacl": "^1.0.3" } } diff --git a/sdk/typescript/test/e2e/example.test.ts b/sdk/typescript/test/e2e/example.test.ts new file mode 100644 index 0000000000000..ffc2d2198114e --- /dev/null +++ b/sdk/typescript/test/e2e/example.test.ts @@ -0,0 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import { describe } from 'vitest'; + +describe.todo('Write some tests that run against localnet.'); diff --git a/sdk/typescript/test/cryptography/ed25519-keypair.test.ts b/sdk/typescript/test/unit/cryptography/ed25519-keypair.test.ts similarity index 97% rename from sdk/typescript/test/cryptography/ed25519-keypair.test.ts rename to sdk/typescript/test/unit/cryptography/ed25519-keypair.test.ts index 7f25681788224..a4d8bd19cd682 100644 --- a/sdk/typescript/test/cryptography/ed25519-keypair.test.ts +++ b/sdk/typescript/test/unit/cryptography/ed25519-keypair.test.ts @@ -3,7 +3,7 @@ import nacl from 'tweetnacl'; import { describe, it, expect } from 'vitest'; -import { Base64DataBuffer, Ed25519Keypair } from '../../src'; +import { Base64DataBuffer, Ed25519Keypair } from '../../../src'; const VALID_SECRET_KEY = 'mdqVWeFekT7pqy5T49+tV12jO0m+ESW7ki4zSU9JiCgbL0kJbj5dvQ/PqcDAzZLZqzshVEs01d1KZdmLh4uZIg=='; diff --git a/sdk/typescript/test/cryptography/ed25519-publickey.test.ts b/sdk/typescript/test/unit/cryptography/ed25519-publickey.test.ts similarity index 64% rename from sdk/typescript/test/cryptography/ed25519-publickey.test.ts rename to sdk/typescript/test/unit/cryptography/ed25519-publickey.test.ts index 6043310eb376c..4a83b44c334f5 100644 --- a/sdk/typescript/test/cryptography/ed25519-publickey.test.ts +++ b/sdk/typescript/test/unit/cryptography/ed25519-publickey.test.ts @@ -2,55 +2,40 @@ // SPDX-License-Identifier: Apache-2.0 import { describe, it, expect } from 'vitest'; -import { Ed25519PublicKey } from '../../src'; +import { Ed25519PublicKey } from '../../../src'; // Test case generated against CLI: // cargo build --bin sui // ../sui/target/debug/sui client new-address ed25519 // ../sui/target/debug/sui keytool list let TEST_CASES = new Map([ - ["UdGRWooy48vGTs0HBokIis5NK+DUjiWc9ENUlcfCCBE=", "3415400a4bfdf924aefa55446e5f4cd6e9a9399f"], - ["0PTAfQmNiabgbak9U/stWZzKc5nsRqokda2qnV2DTfg=", "2e6dad710b343b8655825bc420783aaa5ade08c2"], - ["6L/l0uhGt//9cf6nLQ0+24Uv2qanX/R6tn7lWUJX1Xk=", "607a2403069d547c3fbba4b9e22793c7d78abb1f"], - ["6qZ88i8NJjaD+qZety3qXi4pLptGKS3wwO8bfDmUD+Y=", "7a4b0fd76cce17ef014d64ec5e073117bfc0b4de"], - ["RgdFhZXGe21x48rhe9X+Kh/WyFCo9ft6e9nQKZYHpi0=", "ecd7ef15f92a26bc8f22a88a7786fe1aae1051c6"], + [ + 'UdGRWooy48vGTs0HBokIis5NK+DUjiWc9ENUlcfCCBE=', + '3415400a4bfdf924aefa55446e5f4cd6e9a9399f', + ], + [ + '0PTAfQmNiabgbak9U/stWZzKc5nsRqokda2qnV2DTfg=', + '2e6dad710b343b8655825bc420783aaa5ade08c2', + ], + [ + '6L/l0uhGt//9cf6nLQ0+24Uv2qanX/R6tn7lWUJX1Xk=', + '607a2403069d547c3fbba4b9e22793c7d78abb1f', + ], + [ + '6qZ88i8NJjaD+qZety3qXi4pLptGKS3wwO8bfDmUD+Y=', + '7a4b0fd76cce17ef014d64ec5e073117bfc0b4de', + ], + [ + 'RgdFhZXGe21x48rhe9X+Kh/WyFCo9ft6e9nQKZYHpi0=', + 'ecd7ef15f92a26bc8f22a88a7786fe1aae1051c6', + ], ]); const VALID_KEY_BASE64 = 'Uz39UFseB/B38iBwjesIU1JZxY6y+TRL9P84JFw41W4='; const BASE64_KEY_BYTES = [ - 180, - 107, - 26, - 32, - 169, - 88, - 248, - 46, - 88, - 100, - 108, - 243, - 255, - 87, - 146, - 92, - 42, - 147, - 104, - 2, - 39, - 200, - 114, - 145, - 37, - 122, - 8, - 37, - 170, - 238, - 164, - 236, + 180, 107, 26, 32, 169, 88, 248, 46, 88, 100, 108, 243, 255, 87, 146, 92, 42, + 147, 104, 2, 39, 200, 114, 145, 37, 122, 8, 37, 170, 238, 164, 236, ]; describe('Ed25519PublicKey', () => { @@ -58,39 +43,8 @@ describe('Ed25519PublicKey', () => { // public key length 33 is invalid for Ed25519 expect(() => { new Ed25519PublicKey([ - 3, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, ]); }).toThrow(); @@ -142,4 +96,4 @@ describe('Ed25519PublicKey', () => { expect(key.toSuiAddress()).toEqual(address); }); }); -}); \ No newline at end of file +}); diff --git a/sdk/typescript/test/cryptography/secp256k1-keypair.test.ts b/sdk/typescript/test/unit/cryptography/secp256k1-keypair.test.ts similarity index 85% rename from sdk/typescript/test/cryptography/secp256k1-keypair.test.ts rename to sdk/typescript/test/unit/cryptography/secp256k1-keypair.test.ts index 761743f52ef41..577bbd01fe8c3 100644 --- a/sdk/typescript/test/cryptography/secp256k1-keypair.test.ts +++ b/sdk/typescript/test/unit/cryptography/secp256k1-keypair.test.ts @@ -1,20 +1,20 @@ // Copyright (c) 2022, Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { Base64DataBuffer, Secp256k1Keypair } from '../../src'; +import { Base64DataBuffer, Secp256k1Keypair } from '../../../src'; import { describe, it, expect } from 'vitest'; -import * as secp from "@noble/secp256k1"; +import * as secp from '@noble/secp256k1'; // Test case from https://github.com/rust-bitcoin/rust-secp256k1/blob/master/examples/sign_verify.rs#L26 const VALID_SECP256K1_SECRET_KEY = [ - 59, 148, 11, 85, 134, 130, 61, 253, 2, 174, 59, 70, 27, 180, 51, 107, - 94, 203, 174, 253, 102, 39, 170, 146, 46, 252, 4, 143, 236, 12, 136, 28, + 59, 148, 11, 85, 134, 130, 61, 253, 2, 174, 59, 70, 27, 180, 51, 107, 94, 203, + 174, 253, 102, 39, 170, 146, 46, 252, 4, 143, 236, 12, 136, 28, ]; -// Corresponding to the secret key above. +// Corresponding to the secret key above. export const VALID_SECP256K1_PUBLIC_KEY = [ - 2, 29, 21, 35, 7, 198, 183, 43, 14, 208, 65, 139, 14, 112, 205, 128, 231, - 245, 41, 91, 141, 134, 245, 114, 45, 63, 82, 19, 251, 210, 57, 79, 54, + 2, 29, 21, 35, 7, 198, 183, 43, 14, 208, 65, 139, 14, 112, 205, 128, 231, 245, + 41, 91, 141, 134, 245, 114, 45, 63, 82, 19, 251, 210, 57, 79, 54, ]; // Invalid private key with incorrect length @@ -49,7 +49,9 @@ describe('secp256k1-keypair', () => { }); it('generate keypair from random seed', () => { - const keypair = Secp256k1Keypair.fromSeed(Uint8Array.from(Array(32).fill(8))); + const keypair = Secp256k1Keypair.fromSeed( + Uint8Array.from(Array(32).fill(8)) + ); expect(keypair.getPublicKey().toBase64()).toEqual( 'A/mR+UTR4ZVKf8i5v2Lg148BX0wHdi1QXiDmxFJgo2Yb' ); diff --git a/sdk/typescript/test/cryptography/secp256k1-publickey.test.ts b/sdk/typescript/test/unit/cryptography/secp256k1-publickey.test.ts similarity index 73% rename from sdk/typescript/test/cryptography/secp256k1-publickey.test.ts rename to sdk/typescript/test/unit/cryptography/secp256k1-publickey.test.ts index 38aed6542f801..3725aab8686d1 100644 --- a/sdk/typescript/test/cryptography/secp256k1-publickey.test.ts +++ b/sdk/typescript/test/unit/cryptography/secp256k1-publickey.test.ts @@ -2,20 +2,35 @@ // SPDX-License-Identifier: Apache-2.0 import { describe, it, expect } from 'vitest'; -import { Secp256k1PublicKey } from '../../src/cryptography/secp256k1-publickey'; -import { INVALID_SECP256K1_PUBLIC_KEY, VALID_SECP256K1_PUBLIC_KEY } from './secp256k1-keypair.test'; +import { Secp256k1PublicKey } from '../../../src/cryptography/secp256k1-publickey'; +import { + INVALID_SECP256K1_PUBLIC_KEY, + VALID_SECP256K1_PUBLIC_KEY, +} from './secp256k1-keypair.test'; // Test case generated against CLI: // cargo build --bin sui // ../sui/target/debug/sui client new-address secp256k1 // ../sui/target/debug/sui keytool list let SECP_TEST_CASES = new Map([ - ["AwTC3jVFRxXc3RJIFgoQcv486QdqwYa8vBp4bgSq0gsI", "35057079b5dfc60d650768e2f4f92318f4ea5a77"], - ["A1F2CtldIGolO92Pm9yuxWXs5E07aX+6ZEHAnSuKOhii", "0187cf4234ff80862d5a1665d840df400fef29a0"], - ["Ak5rsa5Od4T6YFN/V3VIhZ/azMMYPkUilKQwc+RiaId+", "70eaff6b7973c57842c2272f00aa19af9f20dc1b"], - ["A4XbJ3fLvV/8ONsnLHAW1nORKsoCYsHaXv9FK1beMtvY", "deb28f733d9f59910cb210d56a46614f9dd28360"], + [ + 'AwTC3jVFRxXc3RJIFgoQcv486QdqwYa8vBp4bgSq0gsI', + '35057079b5dfc60d650768e2f4f92318f4ea5a77', + ], + [ + 'A1F2CtldIGolO92Pm9yuxWXs5E07aX+6ZEHAnSuKOhii', + '0187cf4234ff80862d5a1665d840df400fef29a0', + ], + [ + 'Ak5rsa5Od4T6YFN/V3VIhZ/azMMYPkUilKQwc+RiaId+', + '70eaff6b7973c57842c2272f00aa19af9f20dc1b', + ], + [ + 'A4XbJ3fLvV/8ONsnLHAW1nORKsoCYsHaXv9FK1beMtvY', + 'deb28f733d9f59910cb210d56a46614f9dd28360', + ], ]); - describe('Secp256k1PublicKey', () => { +describe('Secp256k1PublicKey', () => { it('invalid', () => { expect(() => { new Secp256k1PublicKey(INVALID_SECP256K1_PUBLIC_KEY); diff --git a/sdk/typescript/test/mocks/rpc-http.ts b/sdk/typescript/test/unit/mocks/rpc-http.ts similarity index 100% rename from sdk/typescript/test/mocks/rpc-http.ts rename to sdk/typescript/test/unit/mocks/rpc-http.ts diff --git a/sdk/typescript/test/rpc/client.test.ts b/sdk/typescript/test/unit/rpc/client.test.ts similarity index 94% rename from sdk/typescript/test/rpc/client.test.ts rename to sdk/typescript/test/unit/rpc/client.test.ts index 382fab9f7b66c..bb4943d3b7049 100644 --- a/sdk/typescript/test/rpc/client.test.ts +++ b/sdk/typescript/test/unit/rpc/client.test.ts @@ -2,15 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'; -import { JsonRpcClient } from '../../src/rpc/client'; +import { JsonRpcClient } from '../../../src/rpc/client'; import { mockRpcResponse, mockServer, MOCK_ENDPOINT, MOCK_PORT, } from '../mocks/rpc-http'; -import { isGetOwnedObjectsResponse } from '../../src/types/index.guard'; -import { SuiObjectInfo } from '../../src'; +import { isGetOwnedObjectsResponse } from '../../../src/types/index.guard'; +import { SuiObjectInfo } from '../../../src'; const EXAMPLE_OBJECT: SuiObjectInfo = { objectId: '8dc6a6f70564e29a01c7293a9c03818fda2d049f', diff --git a/sdk/typescript/test/signers/raw-signer.test.ts b/sdk/typescript/test/unit/signers/raw-signer.test.ts similarity index 89% rename from sdk/typescript/test/signers/raw-signer.test.ts rename to sdk/typescript/test/unit/signers/raw-signer.test.ts index 837003dfbf33d..48fe10cd4a6f0 100644 --- a/sdk/typescript/test/signers/raw-signer.test.ts +++ b/sdk/typescript/test/unit/signers/raw-signer.test.ts @@ -3,8 +3,13 @@ import nacl from 'tweetnacl'; import { describe, it, expect } from 'vitest'; -import { Base64DataBuffer, Ed25519Keypair, RawSigner, Secp256k1Keypair } from '../../src'; -import * as secp from "@noble/secp256k1"; +import { + Base64DataBuffer, + Ed25519Keypair, + RawSigner, + Secp256k1Keypair, +} from '../../../src'; +import * as secp from '@noble/secp256k1'; describe('RawSigner', () => { it('Ed25519 keypair signData', async () => { diff --git a/sdk/typescript/test/types/framework.test.ts b/sdk/typescript/test/unit/types/framework.test.ts similarity index 89% rename from sdk/typescript/test/types/framework.test.ts rename to sdk/typescript/test/unit/types/framework.test.ts index ddc75ad00e60a..9c14d0d96952c 100644 --- a/sdk/typescript/test/types/framework.test.ts +++ b/sdk/typescript/test/unit/types/framework.test.ts @@ -3,7 +3,7 @@ import { describe, it, expect } from 'vitest'; import mockObjectData from '@mysten/sui-open-rpc/samples/objects.json'; -import { Coin, GetObjectDataResponse } from '../../src'; +import { Coin, GetObjectDataResponse } from '../../../src'; import BN from 'bn.js'; diff --git a/sdk/typescript/test/types/objects.test.ts b/sdk/typescript/test/unit/types/objects.test.ts similarity index 88% rename from sdk/typescript/test/types/objects.test.ts rename to sdk/typescript/test/unit/types/objects.test.ts index 0baf1712d890a..a6dccee5d2997 100644 --- a/sdk/typescript/test/types/objects.test.ts +++ b/sdk/typescript/test/unit/types/objects.test.ts @@ -4,7 +4,7 @@ import { describe, it, expect } from 'vitest'; import mockObjectData from '@mysten/sui-open-rpc/samples/objects.json'; -import { isGetObjectDataResponse } from '../../src/types/index.guard'; +import { isGetObjectDataResponse } from '../../../src/types/index.guard'; describe('Test Objects Definition', () => { it('Test against different object definitions', () => { diff --git a/sdk/typescript/test/types/stringTypes.test.ts b/sdk/typescript/test/unit/types/stringTypes.test.ts similarity index 96% rename from sdk/typescript/test/types/stringTypes.test.ts rename to sdk/typescript/test/unit/types/stringTypes.test.ts index 573a94b8d62ff..f1ea69c3eba26 100644 --- a/sdk/typescript/test/types/stringTypes.test.ts +++ b/sdk/typescript/test/unit/types/stringTypes.test.ts @@ -6,11 +6,11 @@ import { isValidTransactionDigest, isValidSuiAddress, normalizeSuiAddress, -} from '../../src/index'; +} from '../../../src/index'; describe('String type guards', () => { function expectAll(data: T[], check: (value: T) => any, expected: any) { - data.forEach(d => expect(check(d)).toBe(expected)); + data.forEach((d) => expect(check(d)).toBe(expected)); } describe('isValidTransactionDigest()', () => { diff --git a/sdk/typescript/test/types/transactions.test.ts b/sdk/typescript/test/unit/types/transactions.test.ts similarity index 91% rename from sdk/typescript/test/types/transactions.test.ts rename to sdk/typescript/test/unit/types/transactions.test.ts index ef3daf66a3690..3f90daaa406a1 100644 --- a/sdk/typescript/test/types/transactions.test.ts +++ b/sdk/typescript/test/unit/types/transactions.test.ts @@ -4,7 +4,7 @@ import { describe, it, expect } from 'vitest'; import mockTransactionData from '@mysten/sui-open-rpc/samples/transactions.json'; -import { isSuiTransactionResponse } from '../../src/types/index.guard'; +import { isSuiTransactionResponse } from '../../../src/types/index.guard'; describe('Test Transaction Definition', () => { it('Test against different transaction definitions', () => { diff --git a/sdk/typescript/vitest.config.ts b/sdk/typescript/vitest.config.ts index 495273a43a0c9..6b5286d0efe3d 100644 --- a/sdk/typescript/vitest.config.ts +++ b/sdk/typescript/vitest.config.ts @@ -6,6 +6,8 @@ import { configDefaults, defineConfig } from 'vitest/config'; export default defineConfig({ test: { exclude: [...configDefaults.exclude, 'bcs/**'], + minThreads: 1, + maxThreads: 8, }, resolve: { alias: {