Skip to content

Instantly share code, notes, and snippets.

@davidsa
Created June 1, 2016 15:52
Show Gist options
  • Save davidsa/9742345f1f42526d43241b8d221de3bd to your computer and use it in GitHub Desktop.
Save davidsa/9742345f1f42526d43241b8d221de3bd to your computer and use it in GitHub Desktop.
require('blanket');
var chai = require('chai'),
chaiHttp = require('chai-http');
var should = chai.should();
var server = require('../../server');
chai.use(chaiHttp);
describe('Product UT:', function() {
it('should list all products on GET /api/products', function(done) {
chai.request(server)
.get('/api/products')
.end(function(err, res) {
try {
should.exist(res);
res.should.be.a('Object');
res.should.be.json;
res.body.should.be.a('Array');
res.body[0].should.have.property('name');
res.body[0].should.have.property('price');
res.body[0].should.have.property('img');
done();
} catch (e) {
done(e);
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment