fac-15 / SSKM

Week 8

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

✅ Testing queries

astroash opened this issue · comments

commented

SSKM/tests/db.tests.js

Lines 6 to 30 in 867df4d

const getData = cb => {
dbConnection.query(`SELECT * FROM tech`, (err, res) => {
if (err) {
cb(err);
} else {
cb(null, res.rows);
}
});
};
tape("test getData function to get a name of tech", t => {
dbBuild(function(error, response) {
if (error) return console.log("ERROR IN DBBUILD: " + error);
getData(function(err, res) {
if (err) return console.log("ERROR IN GETDATA: " + err);
t.equals(
res[0].name,
"Tape",
"Name of first tech should be Tape"
);
t.end();
});
});
});

Here you have copy and pasted your query. This should be imported from /src/controllers/getAllData.js