fac-15 / SSKM

Week 8

Home Page:https://sskm-tech.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ—ƒ Db connection woes

astroash opened this issue Β· comments

commented

if (process.env.NODE_ENV === "test") {
DB_URL = process.env.TEST_DB_URL;
}
if (!DB_URL) {
throw new Error ('Environment variable DB_URL must be set');
};

When you are running tests, you do not need to worry if there is a DB_URL. This could be added to a else statement on the previous conditional eg

if (process.env.NODE_ENV === "test") {
    //set the DB_URL
} else if (!DB_URL) {
   // throw an error if we dont have a url
};

This will avoid you from having to create two dbs in travs πŸ™ŒπŸ½