Skip to content

Commit

Permalink
database test
Browse files Browse the repository at this point in the history
Relates #20

Co-authored-by: Alexreid95 <alexreid95@gmail.com>
  • Loading branch information
jackherizsmith and Alexreid95 committed May 19, 2020
1 parent b424ea4 commit 6d079db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wip-rest-api/src/model/users-model.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const db = require("../database/connection.js");

// Gets every row from the users table
// Gets username object from the users table
function getUsers() {
return db.query("SELECT username FROM users").then(res => res.rows[0]);
}
Expand Down
11 changes: 6 additions & 5 deletions wip-rest-api/src/test/db.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ describe("File tests are running", () => {
// });
// });

build();

// Tests user-models
describe("Database tests are running", () => {
test("information can be retrieved", () => {
build().then(() => {
getUsers().then((data) => {
test("information can be retrieved", async () => {
await getUsers()
.then((data) => {
expect(data.username).toEqual("CampbellDocherty")
})
})
.catch(console.error)
.catch(console.error)
})
})

Expand Down

0 comments on commit 6d079db

Please sign in to comment.