I am using expect and assert both show up as errors which is what I want and I want the test to fail. But for some reason the test passes when I use either one. I tried expect and then tried assert. Not sure why this is happening. The data I am getting back from the request is correct but it is just that assert and/or expect is not working.
const assert = require('assert');
const expect = require('chai').expect;
const request = require('supertest');
const server = require('../server');
describe('Unit testing the /api/auth/signup route', function () {
it('Should return OK status', async () => {
try {
let res = await request(server).post('/api/auth/signup').send({
email: 'tom@email.com',
password: 'tompassword',
});
// assert.equal(res.body.data.user.email, 'josh@email.com');
expect(res.body.data.user.email).to.equal('josh@email.com');
} catch (err) {
console.log(err);
}
});
});