Created
March 20, 2019 06:25
-
-
Save Bobjayafam/e98166970ebff08706663e47817e6bd4 to your computer and use it in GitHub Desktop.
Sample test for Authors Haven
This file contains 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
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(); | |
}); | |
}); | |
}); |
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
Nice work.
I like how descriptive the test is, it gives a good idea of what that endpoint is doing.