Skip to content

Commit

Permalink
Check results of getData query
Browse files Browse the repository at this point in the history
Relates #18
  • Loading branch information
Albadylic committed Aug 22, 2019
1 parent a46a2bc commit 3e6afe3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/model/database/db_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ require("env2")("./.env");
let DB_URL = process.env.DB_URL;

if (process.env.NODE_ENV === "test") {
console.log("Testing");
DB_URL = process.env.TEST_DB_URL;
}

Expand Down
16 changes: 16 additions & 0 deletions src/tests/database.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@ test("Check table builds", t => {
t.end();
});
});

test("Check getUsers function", t => {
const users = [
{ name: "Gregor" },
{ name: "Andy" },
{ name: "Francesca" },
{ name: "Jack" }
];
runDbBuild((err, res) => {
t.error(err, "No error");
queries.getData.getUsers((err, data) => {
t.deepEqual(users, data, "Correct names are returned");
});
t.end();
});
});

0 comments on commit 3e6afe3

Please sign in to comment.