Skip to content

Commit

Permalink
Update databaseHelper.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Dec 4, 2024
1 parent 26e916c commit 07e2fb1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions api/__tests__/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ describe('Test database initialization', () => {
await databaseHelper.close()
})
})

describe('Test database initialization failures', () => {
it('should check database initialization failures', async () => {
expect(await databaseHelper.initializeLocations()).toBeFalsy()
expect(await databaseHelper.initializeCountries()).toBeFalsy()
expect(await databaseHelper.initializeParkingSpots()).toBeFalsy()
})
})
6 changes: 3 additions & 3 deletions api/src/common/databaseHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const close = async (force: boolean = false): Promise<void> => {
* @async
* @returns {*}
*/
const initializeLocations = async () => {
export const initializeLocations = async () => {
try {
logger.info('Initializing locations...')
const locations = await Location.find({})
Expand Down Expand Up @@ -129,7 +129,7 @@ const initializeLocations = async () => {
* @async
* @returns {*}
*/
const initializeCountries = async () => {
export const initializeCountries = async () => {
try {
logger.info('Initializing countries...')
const countries = await Country.find({})
Expand Down Expand Up @@ -190,7 +190,7 @@ const initializeCountries = async () => {
* @async
* @returns {*}
*/
const initializeParkingSpots = async () => {
export const initializeParkingSpots = async () => {
try {
logger.info('Initializing parkingSpots...')
const parkingSpots = await ParkingSpot.find({})
Expand Down

0 comments on commit 07e2fb1

Please sign in to comment.