Skip to content

Commit

Permalink
close the connection in after function; otherwise mocha hangs and won…
Browse files Browse the repository at this point in the history
…'t exit
  • Loading branch information
linkinchow committed May 12, 2020
1 parent 6d3f836 commit fcd071f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/PatientTestsApi/Test/Fixtures/DBFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ export class DBFixture {
return await this.mongoDb.collection(this.settings.patientCollection).findOne({_id: id});
}

public async close(): Promise<void> {
// close the connection
await this.mongoClient.close(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe("PatientDataService #integaration", async function (): Promise<void> {

after(async function (): Promise<void> {
await db.cleanPatients();
await db.close();
});
});

Expand Down

0 comments on commit fcd071f

Please sign in to comment.