From 245410a32365edca089b77a2652baf11df5869ff Mon Sep 17 00:00:00 2001 From: Sergei Popinevskii Date: Tue, 19 Sep 2023 22:44:58 +0300 Subject: [PATCH] refactor getDatabase: cleanup code --- tests/database.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/database.ts b/tests/database.ts index 3d0a7bd..a87c6b5 100644 --- a/tests/database.ts +++ b/tests/database.ts @@ -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