Skip to content

Commit

Permalink
refactor getDatabase: cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
gurza committed Sep 19, 2023
1 parent 618ccd5 commit 245410a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const driver = new Driver({ endpoint, database, authService })

export const getDatabase = async () => {
const timeout = 2000 // Should be less then Jest timeout
if (!(await driver.ready(timeout)))

const isReady = await driver.ready(timeout)
if (!isReady)
throw new Error(`Database has not become ready in ${timeout}ms!`)

return driver
Expand Down

0 comments on commit 245410a

Please sign in to comment.