Skip to content

Commit

Permalink
fix: singleton db disabled in test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Dec 20, 2021
1 parent bf3fca5 commit ecb016f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const createDatabaseGetter = ({
}

const getDB = async ({ seed, migrate, testMode, user } = {}) => {
if (singletonDB) return singletonDB
if (singletonDB && !testMode) return singletonDB

testMode =
testMode === undefined ? Boolean(process.env.USE_TEST_DB) : testMode
Expand Down Expand Up @@ -180,7 +180,9 @@ const createDatabaseGetter = ({
},
})

singletonDB = proxiedPg
if (!testMode) {
singletonDB = proxiedPg
}

return proxiedPg
}
Expand Down

0 comments on commit ecb016f

Please sign in to comment.