Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fake data #34

Open
AbdallahAmmar96 opened this issue Aug 28, 2019 · 0 comments
Open

Fake data #34

AbdallahAmmar96 opened this issue Aug 28, 2019 · 0 comments

Comments

@AbdallahAmmar96
Copy link

const expected = [
{ id: 1, username: 'mohammed', password: 'password1', email: '[email protected]' },
{ id: 2, username: 'fadi', password: '1', email: '[email protected]' },
{ id: 3, username: 'mai', password: '1', email: '[email protected]' },
{ id: 4, username: 'amooda', password: '1', email: '[email protected]' }
];
dbBuild()
.then(() => user.selectAll())
.then(res => res.rows)
.then(res => {
t.deepEqual(res, expected, 'the table of user should contain four user');
t.deepEqual(
Object.keys(res[0]),
['id', 'username', 'password', 'email'],
' the keys of first user object should return id and name'
);
t.equal(res[0].id, 1, 'the first id in the user is 1');

The test for the keys in the query result is enough to make sure the query is running correctly, you don't need to test the value of keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant