Skip to content

Commit

Permalink
fix: dataStoreDeleteVerifiableCredential
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Aug 5, 2021
1 parent 2bc69e4 commit 1f45475
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions __tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ let dbConnection: Promise<Connection>

const setup = async (options?: IAgentOptions): Promise<boolean> => {
dbConnection = createConnection({
name: 'test',
type: 'sqlite',
database: databaseFile,
synchronize: true,
Expand Down
1 change: 1 addition & 0 deletions __tests__/localMemoryStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ let dbConnection: Promise<Connection>

const setup = async (options?: IAgentOptions): Promise<boolean> => {
dbConnection = createConnection({
name: 'test',
type: 'sqlite',
database: databaseFile,
synchronize: true,
Expand Down
1 change: 1 addition & 0 deletions __tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const getAgent = (options?: IAgentOptions) =>

const setup = async (options?: IAgentOptions): Promise<boolean> => {
dbConnection = createConnection({
name: 'test',
type: 'sqlite',
database: databaseFile,
synchronize: true,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/shared/didDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;')

Expand Down
4 changes: 1 addition & 3 deletions packages/data-store/src/data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 1f45475

Please sign in to comment.