Skip to content

Commit

Permalink
test(indy-vdr): update e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Stekelenburg <[email protected]>
  • Loading branch information
karimStekelenburg committed Feb 11, 2023
1 parent 2f4fa3e commit f5b3b1e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
1 change: 0 additions & 1 deletion packages/indy-vdr/src/pool/IndyVdrPoolService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { IndyVdrPoolConfig } from './IndyVdrPool'
import type { AgentContext } from '@aries-framework/core'
import type { GetNymResponse } from '@hyperledger/indy-vdr-shared'

Expand Down
13 changes: 13 additions & 0 deletions packages/indy-vdr/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ import type { AgentContext, Key } from '@aries-framework/core'
import { KeyType } from '@aries-framework/core'
import { AttribRequest, NymRequest } from '@hyperledger/indy-vdr-shared'

import { genesisTransactions } from '../../core/tests/helpers'
import { IndyVdrModuleConfig } from '../src/IndyVdrModuleConfig'
import { indyDidFromPublicKeyBase58 } from '../src/utils/did'

export const indyVdrModuleConfig = new IndyVdrModuleConfig({
networks: [
{
genesisTransactions,
indyNamespace: 'local:test',
isProduction: false,
transactionAuthorAgreement: { version: '1', acceptanceMechanism: 'accept' },
},
],
})

export async function createDidOnLedger(
indyVdrPoolService: IndyVdrPoolService,
agentContext: AgentContext,
Expand Down
14 changes: 4 additions & 10 deletions packages/indy-vdr/tests/indy-vdr-anoncreds-registry.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import { Agent } from '@aries-framework/core'

import { agentDependencies, genesisTransactions, getAgentConfig } from '../../core/tests/helpers'
import { agentDependencies, getAgentConfig } from '../../core/tests/helpers'
import { IndyVdrAnonCredsRegistry } from '../src/anoncreds/IndyVdrAnonCredsRegistry'
import { IndyVdrPoolService } from '../src/pool'

import { indyVdrModuleConfig } from './helpers'

const agentConfig = getAgentConfig('IndyVdrAnonCredsRegistry')

// TODO: update to module once available
const indyVdrPoolService = new IndyVdrPoolService(agentConfig.logger)
indyVdrPoolService.setPools([
{
genesisTransactions,
indyNamespace: 'local:test',
isProduction: false,
transactionAuthorAgreement: { version: '1', acceptanceMechanism: 'accept' },
},
])
const indyVdrPoolService = new IndyVdrPoolService(agentConfig.logger, indyVdrModuleConfig)

const indyVdrAnonCredsRegistry = new IndyVdrAnonCredsRegistry()

Expand Down
14 changes: 3 additions & 11 deletions packages/indy-vdr/tests/indy-vdr-did-resolver.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
} from '@aries-framework/core'

import { parseDid } from '../../core/src/modules/dids/domain/parse'
import { agentDependencies, genesisTransactions, getAgentConfig, getAgentContext } from '../../core/tests/helpers'
import { agentDependencies, getAgentConfig, getAgentContext } from '../../core/tests/helpers'
import testLogger from '../../core/tests/logger'
import { IndyVdrSovDidResolver } from '../src/dids'
import { IndyVdrPoolService } from '../src/pool/IndyVdrPoolService'
import { indyDidFromPublicKeyBase58 } from '../src/utils/did'

import { createDidOnLedger } from './helpers'
import { createDidOnLedger, indyVdrModuleConfig } from './helpers'

const logger = testLogger
const wallet = new IndyWallet(agentDependencies, logger, new SigningProviderRegistry([]))
Expand All @@ -25,26 +25,18 @@ const agentConfig = getAgentConfig('IndyVdrResolver E2E', { logger })
const cache = new InMemoryLruCache({ limit: 200 })
const indyVdrSovDidResolver = new IndyVdrSovDidResolver()

const config = {
isProduction: false,
genesisTransactions,
indyNamespace: `pool:localtest`,
transactionAuthorAgreement: { version: '1', acceptanceMechanism: 'accept' },
} as const

let signerKey: Key

const agentContext = getAgentContext({
wallet,
agentConfig,
registerInstances: [
[IndyVdrPoolService, new IndyVdrPoolService(logger)],
[IndyVdrPoolService, new IndyVdrPoolService(logger, indyVdrModuleConfig)],
[CacheModuleConfig, new CacheModuleConfig({ cache })],
],
})

const indyVdrPoolService = agentContext.dependencyManager.resolve(IndyVdrPoolService)
indyVdrPoolService.setPools([config])

describe('IndyVdrSov', () => {
beforeAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/indy-vdr/tests/indy-vdr-pool.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { IndyVdrPool } from '../src/pool'
import { IndyVdrPoolService } from '../src/pool/IndyVdrPoolService'
import { indyDidFromPublicKeyBase58 } from '../src/utils/did'

const indyVdrPoolService = new IndyVdrPoolService(testLogger)
import { indyVdrModuleConfig } from './helpers'

const indyVdrPoolService = new IndyVdrPoolService(testLogger, indyVdrModuleConfig)
const wallet = new IndyWallet(agentDependencies, testLogger, new SigningProviderRegistry([]))
const agentConfig = getAgentConfig('IndyVdrPoolService')
const agentContext = getAgentContext({ wallet, agentConfig })
Expand All @@ -23,8 +25,6 @@ const config = {

let signerKey: Key

indyVdrPoolService.setPools([config])

describe('IndyVdrPoolService', () => {
beforeAll(async () => {
await indyVdrPoolService.connectToPools()
Expand Down

0 comments on commit f5b3b1e

Please sign in to comment.