Skip to content

Commit

Permalink
Add database.test.ts comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Nov 19, 2024
1 parent ddb6bd1 commit 509c42e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/tests/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ beforeAll(() => {

describe('Test database connection', () => {
it('should connect to database', async () => {
// test success (connected)
const res = await databaseHelper.connect(env.DB_URI, false, false)
expect(res).toBeTruthy()
await databaseHelper.close()
Expand All @@ -21,6 +22,7 @@ describe('Test database connection', () => {

describe('Test database connection failure', () => {
it('should fail connecting to database', async () => {
// test failure (wrong uri)
const res = await databaseHelper.connect('wrong-uri', true, false)
expect(res).toBeFalsy()
})
Expand Down Expand Up @@ -58,6 +60,7 @@ describe('Test database initialization', () => {
const ps2 = new ParkingSpot({ latitude: 1, longitude: 1, values: [pv2.id] })
await ps2.save()

// test success (initialization)
await testHelper.delay(5 * 1000)
res = await databaseHelper.initialize()
expect(res).toBeTruthy()
Expand Down

0 comments on commit 509c42e

Please sign in to comment.