I have the following test
describe('User - Sign up', function() {
it('should not register a new user because of missing data on form', function (done) {
const email = "testemail@gmail.com";
const req = { body: { email: email }};
const signUp = controller.signUp(req);
console.log(signUp);
signUp
.then(data => {
console.log('ok');
})
.catch(err => {
console.log('error')
});
done();
});
being signUp function the following:
return new Promise(((resolve, reject) => {
validator.checkAsync(async () => {
const user = {
email: req.body.email,
password: await pwdHash.hashPassword(req.body.password)
}
await store.signUp(user);
resolve({
valid: true
});
}, () => {
reject(validator.errors);
});
}));
However, the test is not returning any console log and it's going through. What am I missing?
Aucun commentaire:
Enregistrer un commentaire