Created
June 1, 2016 15:52
-
-
Save davidsa/9742345f1f42526d43241b8d221de3bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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