diff --git a/__tests__/localAgent.test.ts b/__tests__/localAgent.test.ts index 85aec35ea..322f1e5b9 100644 --- a/__tests__/localAgent.test.ts +++ b/__tests__/localAgent.test.ts @@ -78,6 +78,7 @@ let dbConnection: Promise const setup = async (options?: IAgentOptions): Promise => { dbConnection = createConnection({ + name: 'test', type: 'sqlite', database: databaseFile, synchronize: true, diff --git a/__tests__/localMemoryStoreAgent.test.ts b/__tests__/localMemoryStoreAgent.test.ts index 8519933f5..417cf35c8 100644 --- a/__tests__/localMemoryStoreAgent.test.ts +++ b/__tests__/localMemoryStoreAgent.test.ts @@ -65,6 +65,7 @@ let dbConnection: Promise const setup = async (options?: IAgentOptions): Promise => { dbConnection = createConnection({ + name: 'test', type: 'sqlite', database: databaseFile, synchronize: true, diff --git a/__tests__/restAgent.test.ts b/__tests__/restAgent.test.ts index 7b36da876..131185807 100644 --- a/__tests__/restAgent.test.ts +++ b/__tests__/restAgent.test.ts @@ -101,6 +101,7 @@ const getAgent = (options?: IAgentOptions) => const setup = async (options?: IAgentOptions): Promise => { dbConnection = createConnection({ + name: 'test', type: 'sqlite', database: databaseFile, synchronize: true, diff --git a/__tests__/shared/didDiscovery.ts b/__tests__/shared/didDiscovery.ts index 572daa7c6..67ee69810 100644 --- a/__tests__/shared/didDiscovery.ts +++ b/__tests__/shared/didDiscovery.ts @@ -103,7 +103,7 @@ export default (testContext: { // THIS HAS TO BE THE LAST TEST IN THIS FILE! it('should return errors', async () => { - const connection = getConnection() + const connection = getConnection('test') await connection.query('PRAGMA foreign_keys = OFF;') await connection.query('DROP TABLE claim;') diff --git a/packages/data-store/src/data-store.ts b/packages/data-store/src/data-store.ts index 21f520f7e..bd0d5bcfd 100644 --- a/packages/data-store/src/data-store.ts +++ b/packages/data-store/src/data-store.ts @@ -67,9 +67,7 @@ export class DataStore implements IAgentPlugin { .getRepository(Claim) .find({ where: [{ credential: credentialEntity }] }) - claims.forEach(async (claim) => { - await claim.remove() - }) + await (await this.dbConnection).getRepository(Claim).remove(claims) await (await this.dbConnection).getRepository(Credential).remove(credentialEntity)