Skip to content

Instantly share code, notes, and snippets.

@Bobjayafam
Created March 20, 2019 06:25
Show Gist options
  • Save Bobjayafam/e98166970ebff08706663e47817e6bd4 to your computer and use it in GitHub Desktop.
Save Bobjayafam/e98166970ebff08706663e47817e6bd4 to your computer and use it in GitHub Desktop.
Sample test for Authors Haven
import chai from 'chai';
import chaiHttp from 'chai-http';
import app from '../app';
chai.use(chaiHttp);
const should = chai.should();
describe('GET user profile', () => {
it('should return a single user profile', (done) => {
chai.request(app)
.get('/api/profiles/jackie')
.end((err, res) => {
should.not.exist(err);
should.exist(res);
res.status.should.eql(200);
res.body.profile.should.be.an('object');
res.body.profile.should.have.property('username');
res.body.profile.should.have.property('bio');
res.body.profile.should.have.property('image');
res.body.profile.should.have.property('following');
done();
});
});
});
@Bobjayafam
Copy link
Author

Nice work.
I like how descriptive the test is, it gives a good idea of what that endpoint is doing.

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment