Skip to content

Commit

Permalink
rever vitest
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Sep 13, 2024
1 parent 62cfa97 commit 13a922e
Show file tree
Hide file tree
Showing 33 changed files with 1,164 additions and 935 deletions.
2 changes: 1 addition & 1 deletion wrappers/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ First make sure you've built the library using the `build.sh` script in the root
Then run the tests with the following command. This will automatically use the local build of Indy VDR.

```sh
pnpm test:local-build
pnpm test:local
```

## Releasing
Expand Down
2 changes: 1 addition & 1 deletion wrappers/javascript/indy-vdr-nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cd wrappers/javascript

docker exec $(docker ps -aqf "ancestor=test_pool") cat /var/lib/indy/sandbox/pool_transactions_genesis >> genesis.txn

pnpm test:local-build
pnpm test:local
```

> **Note**: If you want to use this library in a cross-platform environment you need to import methods from the `@hyperledger/indy-vdr-shared` package instead. This is a platform independent package that allows to register the native bindings. The `@hyperledger/indy-vdr-nodejs` package uses this package under the hood. See the [Indy VDR Shared README](https://github.com/hyperledger/indy-vdr/tree/main/wrappers/javascript/indy-vdr-shared/README.md) for documentation on how to use this package.
Expand Down
16 changes: 16 additions & 0 deletions wrappers/javascript/indy-vdr-nodejs/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Config } from '@jest/types'

const config: Config.InitialOptions = {
verbose: true,
testTimeout: 120000,
moduleNameMapper: {
'^@hyperledger/indy-vdr-shared$': '<rootDir>/../indy-vdr-shared/src',
'^@hyperledger/indy-vdr-nodejs$': '<rootDir>/src',
},
testEnvironment: 'node',
transform: {
'^.+.tsx?$': ['ts-jest', {}],
},
}

export default config
7 changes: 6 additions & 1 deletion wrappers/javascript/indy-vdr-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
"build": "pnpm clean && pnpm compile",
"clean": "rimraf -rf ./build",
"compile": "tsc -p tsconfig.build.json",
"install": "node scripts/install.js"
"install": "node scripts/install.js",
"test": "jest"
},
"devDependencies": {
"@jest/types": "^29.6.3",
"@types/jest": "^29.5.13",
"@types/node": "^20.14.2",
"@types/ref-struct-di": "^1.1.6",
"jest": "^29.7.0",
"rimraf": "^5.0.7",
"ts-jest": "^29.2.5",
"typescript": "~5.4.5"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { describe, expect, test } from 'vitest'
import { DID, setupPool } from './utils'

import { AcceptanceMechanismsRequest } from '@hyperledger/indy-vdr-nodejs'
console.log('hell')

describe('AcceptanceMechanismsRequest', () => {
const pool = setupPool()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { describe, expect, test } from 'vitest'
import { DID, setupPool } from './utils'

import { AttribRequest } from '@hyperledger/indy-vdr-nodejs'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CredentialDefinitionRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { DID, setupPool } from './utils'

describe('CredentialDefinitionRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { describe, expect, test } from 'vitest'
import { DID, setupPool } from './utils'

import { CustomRequest } from '@hyperledger/indy-vdr-nodejs'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DisableAllTransactionAuthorAgreementsRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { DID, setupPool } from './utils'

describe('DisableAllTransactionsAuthorAgreementRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetAcceptanceMechanismsResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetAcceptanceMechanismsRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { setupPool } from './utils'

describe('GetAcceptanceMechanismsRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetAttribResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetAttribRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { DID, setupPool } from './utils'

describe('GetAttribRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetCredentialDefinitionResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetCredentialDefinitionRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { CRED_DEF_ID, setupPool } from './utils'

describe('GetCredentialDefinitionRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetNymResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetNymRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { DID, setupPool } from './utils'

describe('GetNymRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetRevocationRegistryDefinitionResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetRevocationRegistryDefinitionRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { REVOC_REG_DEF_ID, setupPool } from './utils'

describe('GetRevocationRegistryDefinitionRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetRevocationRegistryDeltaResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetRevocationRegistryDeltaRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { REVOC_REG_DEF_ID, setupPool } from './utils'

describe('GetRevocationRegistryDeltaRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetRevocationRegistryResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetRevocationRegistryRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { REVOC_REG_DEF_ID, setupPool } from './utils'

describe('GetRevocationRegistryRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetSchemaResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetSchemaRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { SCHEMA_ID, setupPool } from './utils'

describe('GetSchemaRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetTransactionAuthorAgreementResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetTransactionAuthorAgreementRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { setupPool } from './utils'

describe('GetTransactionAuthorAgreementRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetTransactionResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetTransactionRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { setupPool } from './utils'

describe('GetTransactionRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetValidatorInfoResponse } from '@hyperledger/indy-vdr-nodejs'

import { GetValidatorInfoAction } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { DID, setupPool } from './utils'

describe('GetValidatorInfoAction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { IndyVdrPool } from '@hyperledger/indy-vdr-nodejs'

import { PoolCreate } from '@hyperledger/indy-vdr-nodejs'
import { beforeAll, describe, expect, test } from 'vitest'
import { genesisTxnPath } from './utils'

describe('IndyVdrPool', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { IndyVdrRequest } from '@hyperledger/indy-vdr-nodejs'

import { GetSchemaRequest } from '@hyperledger/indy-vdr-nodejs'
import { afterAll, beforeAll, describe, expect, test } from 'vitest'
import { DID, SCHEMA_ID } from './utils'

describe('IndyVdrRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { genesisTxnPath } from './utils'
import { accessSync, rmSync } from 'node:fs'
import { PoolCreate } from '@hyperledger/indy-vdr-nodejs'
import { GetTransactionRequest, indyVdr } from '@hyperledger/indy-vdr-shared'
import { afterAll, beforeAll, describe, expect, test } from 'vitest'

describe('IndyVdrTxnCache', () => {
let pool: IndyVdrPool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NymRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { DID, setupPool } from './utils'

describe('NymRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CRED_DEF_ID, DID, setupPool } from './utils'

import { RevocationRegistryDefinitionRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

describe('RevocationRegistryDefinitionRequest', () => {
const pool = setupPool()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DID, REVOC_REG_DEF_ID, setupPool } from './utils'

import { RevocationRegistryEntryRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

describe('RevocationRegistryEntryRequest', () => {
const pool = setupPool()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { describe, expect, test } from 'vitest'
import { SchemaRequest } from '../src'
import { DID, SCHEMA_ID, setupPool } from './utils'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionAuthorAgreementRequest } from '@hyperledger/indy-vdr-nodejs'
import { describe, expect, test } from 'vitest'

import { DID, setupPool } from './utils'

describe('TransactionAuthorAgreementRequest', () => {
Expand Down
2 changes: 1 addition & 1 deletion wrappers/javascript/indy-vdr-nodejs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["node"]
"types": ["node", "jest"]
}
}
12 changes: 4 additions & 8 deletions wrappers/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
"style:fix": "biome check . --write --unsafe",
"validate": "pnpm style:check && pnpm types:check",
"reset": "find . -type dir -name node_modules | xargs rm -rf && rm -rf pnpm-lock.yaml",
"react-native": "pnpm --cwd indy-vdr-react-native",
"shared": "pnpm --cwd indy-vdr-shared",
"nodejs": "pnpm --cwd indy-vdr-nodejs",
"test": "vitest run",
"test:local-build": "cross-env LIB_INDY_VDR_PATH=../../target/release pnpm test",
"test": "pnpm -r run test",
"test:local": "cross-env LIB_INDY_VDR_PATH=../../../target/release pnpm test",
"set-version": "lerna version --exact --no-git-tag-version --no-push --yes"
},
"repository": {
Expand All @@ -26,8 +23,7 @@
"@biomejs/biome": "1.8.0",
"cross-env": "^7.0.3",
"lerna": "8.1.3",
"typescript": "~5.4.5",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0"
"ts-node": "^10.9.2",
"typescript": "~5.4.5"
}
}
Loading

0 comments on commit 13a922e

Please # to comment.