Skip to content

Commit

Permalink
test: fix broken tests
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Jul 18, 2022
1 parent b555236 commit 6ee9da5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/modules/ledger/__tests__/LedgerApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -132,7 +133,8 @@ describe('LedgerApi', () => {
ledgerService,
agentContext,
anonCredsCredentialDefinitionRepository,
anonCredsSchemaRepository
anonCredsSchemaRepository,
new LedgerModuleConfig()
)
})

Expand All @@ -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()
})
})
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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)
})
})

0 comments on commit 6ee9da5

Please sign in to comment.