Skip to content

Commit

Permalink
fix: Fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zoemaas committed May 8, 2024
1 parent 2a9be95 commit d01859d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 2 additions & 7 deletions packages/oid4vci-holder/__tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import { DataSource } from 'typeorm'
import { createObjects, getConfig } from '../../agent-config/dist'
import eventLoggerAgentLogic from './shared/oid4vciHolderLogicAgentLogic'

jest.setTimeout(60000)

import eventLoggerAgentLogic from './shared/oid4vciHolderLogicAgentLogic'

let dbConnection: Promise<DataSource>
let agent: any

const setup = async (): Promise<boolean> => {
const config = await getConfig('packages/oid4vci-holder/agent.yml')
const { localAgent, db } = await createObjects(config, { localAgent: '/agent' })
const { localAgent } = await createObjects(config, { localAgent: '/agent' })
agent = localAgent
dbConnection = db

return true
}

const tearDown = async (): Promise<boolean> => {
await (await dbConnection).close()
return true
}

Expand Down
8 changes: 2 additions & 6 deletions packages/oid4vci-holder/__tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import 'cross-fetch/polyfill'
// @ts-ignore
import express, { Router } from 'express'
import { Server } from 'http'
import { DataSource } from 'typeorm'
import { IAgent, createAgent, IAgentOptions } from '@veramo/core'
import { createAgent, IAgent, IAgentOptions } from '@veramo/core'
import { AgentRestClient } from '@veramo/remote-client'
import { AgentRouter, RequestWithAgentRouter } from '@veramo/remote-server'
import { createObjects, getConfig } from '../../agent-config/dist'
Expand All @@ -17,7 +16,6 @@ const basePath = '/agent'

let serverAgent: IAgent
let restServer: Server
let dbConnection: Promise<DataSource>

const getAgent = (options?: IAgentOptions) =>
createAgent<IOID4VCIHolder>({
Expand All @@ -33,9 +31,8 @@ const getAgent = (options?: IAgentOptions) =>

const setup = async (): Promise<boolean> => {
const config = await getConfig('packages/oid4vci-holder/agent.yml')
const { agent, db } = await createObjects(config, { agent: '/agent', db: '/dbConnection' })
const { agent } = await createObjects(config, { agent: '/agent' })
serverAgent = agent
dbConnection = db

const agentRouter: Router = AgentRouter({
exposedMethods: serverAgent.availableMethods(),
Expand All @@ -56,7 +53,6 @@ const setup = async (): Promise<boolean> => {

const tearDown = async (): Promise<boolean> => {
restServer.close()
await (await dbConnection).close()
return true
}

Expand Down

0 comments on commit d01859d

Please sign in to comment.