From 6ee9da55af1388c3f5dbe8d5e2890b8e01dc3a38 Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Mon, 18 Jul 2022 12:50:04 +0200 Subject: [PATCH] test: fix broken tests Signed-off-by: Timo Glastra --- .../core/src/modules/ledger/__tests__/LedgerApi.test.ts | 6 ++++-- .../core/src/modules/ledger/__tests__/LedgerModule.test.ts | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/src/modules/ledger/__tests__/LedgerApi.test.ts b/packages/core/src/modules/ledger/__tests__/LedgerApi.test.ts index 196e3443a1..9dffbe20ac 100644 --- a/packages/core/src/modules/ledger/__tests__/LedgerApi.test.ts +++ b/packages/core/src/modules/ledger/__tests__/LedgerApi.test.ts @@ -11,6 +11,7 @@ import { AnonCredsCredentialDefinitionRepository } from '../../indy/repository/A import { AnonCredsSchemaRecord } from '../../indy/repository/AnonCredsSchemaRecord' import { AnonCredsSchemaRepository } from '../../indy/repository/AnonCredsSchemaRepository' import { LedgerApi } from '../LedgerApi' +import { LedgerModuleConfig } from '../LedgerModuleConfig' import { generateCredentialDefinitionId, generateSchemaId } from '../ledgerUtil' import { IndyLedgerService } from '../services/IndyLedgerService' @@ -132,7 +133,8 @@ describe('LedgerApi', () => { ledgerService, agentContext, anonCredsCredentialDefinitionRepository, - anonCredsSchemaRepository + anonCredsSchemaRepository, + new LedgerModuleConfig() ) }) @@ -141,7 +143,7 @@ describe('LedgerApi', () => { describe('connectToPools', () => { it('should connect to all pools', async () => { mockFunction(ledgerService.connectToPools).mockResolvedValue([1, 2, 4]) - await expect(ledgerApi.connectToPools()).resolves + await expect(ledgerApi.connectToPools()).resolves.toBeUndefined() expect(ledgerService.connectToPools).toHaveBeenCalled() }) }) diff --git a/packages/core/src/modules/ledger/__tests__/LedgerModule.test.ts b/packages/core/src/modules/ledger/__tests__/LedgerModule.test.ts index 9a1461c6ef..b258bd5416 100644 --- a/packages/core/src/modules/ledger/__tests__/LedgerModule.test.ts +++ b/packages/core/src/modules/ledger/__tests__/LedgerModule.test.ts @@ -1,4 +1,6 @@ import { DependencyManager } from '../../../plugins/DependencyManager' +import { AnonCredsCredentialDefinitionRepository } from '../../indy/repository/AnonCredsCredentialDefinitionRepository' +import { AnonCredsSchemaRepository } from '../../indy/repository/AnonCredsSchemaRepository' import { LedgerApi } from '../LedgerApi' import { LedgerModule } from '../LedgerModule' import { IndyLedgerService, IndyPoolService } from '../services' @@ -15,8 +17,10 @@ describe('LedgerModule', () => { expect(dependencyManager.registerContextScoped).toHaveBeenCalledTimes(1) expect(dependencyManager.registerContextScoped).toHaveBeenCalledWith(LedgerApi) - expect(dependencyManager.registerSingleton).toHaveBeenCalledTimes(2) + expect(dependencyManager.registerSingleton).toHaveBeenCalledTimes(4) expect(dependencyManager.registerSingleton).toHaveBeenCalledWith(IndyLedgerService) expect(dependencyManager.registerSingleton).toHaveBeenCalledWith(IndyPoolService) + expect(dependencyManager.registerSingleton).toHaveBeenCalledWith(AnonCredsCredentialDefinitionRepository) + expect(dependencyManager.registerSingleton).toHaveBeenCalledWith(AnonCredsSchemaRepository) }) })