Thursday, 8 June 2017

chai expect passing when returned value is undefined

It seems to me that this test should not be passing

chai test

const chai = require('chai')
const expect = chai.expect;
const chaiHttp = require('chai-http');
const request = chaiHttp.expect;
const config = require('../../app/config');
const worker = require('../../app/worker');

chai.use(chaiHttp);

describe('server response', function () {
    .....

    it('should return 200', function () {
        chai.request(`http://localhost:${config.port}`)
        .get('/')
        .end(function (err, res) {
            expect('as').to.have.status(200);
        });
    });
});

Temrinal

> NODE_ENV=test mocha --timeout 20000 --recursive test/ --compilers js:babel-core/register



  server response
    ✓ should return 200


  1 passing (150ms)



via Jamie Hutber

No comments:

Post a Comment