Skip to content

Instantly share code, notes, and snippets.

@cop1fab
Last active March 14, 2019 08:00
Show Gist options
  • Save cop1fab/5b66bc7ca5f7f2496a42a2e12b3d928d to your computer and use it in GitHub Desktop.
Save cop1fab/5b66bc7ca5f7f2496a42a2e12b3d928d to your computer and use it in GitHub Desktop.
import chai from 'chai';
import chaiHttp from 'chai-http';
import app from '../../app';
const {
expect
} = chai;
chai.use(chaiHttp);
let token = '';
/* like and article*/
describe('like', () => {
it('it should upvote an article', (done) => {
chai.request(app)
.patch('/api/v1/article/1/like')
.set('access-token', token)
.end((err, res) => {
expect(res.status).to.equal(200);
done();
});
});
}); // end of test
/* Dislike an article*/
describe('dislike', () => {
it('it should dislike an article', (done) => {
chai.request(app)
.patch('/api/v1/article/1/dislike')
.set('access-token', token)
.end((err, res) => {
expect(res.status).to.equal(200);
done();
});
});
}); // end of test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment