Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createdb () {
ormnomnom.setConnection(getConnection)
return pgtools.dropdb({}, TEST_DB_NAME).catch(err => {
// ignore this error since it throws if the db doesn't exist
if (err.name !== 'invalid_catalog_name') {
throw err
}
}).then(() => {
return pgtools.createdb({}, TEST_DB_NAME)
}).then(() => {
return getConnection().then(client => {
return client.query(fs.readFileSync(path.join(__dirname, 'fixture.sql'), { encoding: 'utf8' })).then(() => client.end())
})
})
}
}).then(() => {
return pgtools.createdb({}, TEST_DB_NAME)
}).then(() => {
return getConnection().then(client => {