Skip to content

Commit

Permalink
#164722267 update swagger documentation (#45)
Browse files Browse the repository at this point in the history
* chore(documentation) update swagger documentation

* #163519160 Add reading statistics for users and articles (#44)

* feat(reading stats): add reading statistics

-add reading stats of individuals
-add views of an article

[Delivers #163519160]

* chore(documentation) update swagger documentation

* #163519156 Users should be able to bookmark articles for reading later (#43)

* feat(bookmark): add unit tests [Starts #163519156]

* feat(bookmark): implement bookmark/remove bookmark functionality [Finishes #163519156
]

* feat(bookmark): implement bookmark/remove bookmark [Finishes #163519156]

* fix(conflicts): fix conflicts from rebase

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* feat(bookmark): add unit tests [Starts #163519156]

* feat(bookmark): implement bookmark/remove bookmark functionality [Finishes #163519156
]

* feat(bookmark): implement bookmark/remove bookmark [Finishes #163519156]

* fix(conflicts): fix conflicts from rebase

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(conflicts): fix conflicts form rebase develop

* feat(bookmark): add unit tests [Starts #163519156]

* feat(bookmark): implement bookmark/remove bookmark functionality [Finishes #163519156
]

* feat(bookmark): implement bookmark/remove bookmark [Finishes #163519156]

* fix(conflicts): fix conflicts from rebase

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* feat(bookmark): add unit tests [Starts #163519156]

* feat(bookmark): implement bookmark/remove bookmark functionality [Finishes #163519156
]

* feat(bookmark): implement bookmark/remove bookmark [Finishes #163519156]

* fix(conflicts): fix conflicts from rebase

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(tests): fix test issues

* fix(conflicts): fix conflicts form rebase develop

* fix(conflicts): fix conflicts from rebase

* fix(conflicts): fix conflicts from rebase

* fix(tests): fix build failed

* fix(tests): fix build failed

* chore(documentation) update swagger documentation

* feat(documentation) update swagger documentation

* feat(documentation) update swagger documentation
- [finishes #164722267]

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* #163519163 Add track comment history functionality (#46)

* feat(comment): add track comment history

- add tests
- create comment history model and migration
- add comment history functionality
- add comment history route

[Delivers #163519163]

* chore(documentation) update swagger documentation

* feat(documentation) update swagger documentation

* feat(documentation) update swagger documentation
- [finishes #164722267]

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* feat(documentation) update swagger documentation
- update readme

* feat(comment) comment on highlighted text
- git rebase

* feat(documentation) update swagger documentation

* feat(documentation) update swagger documentation

* feat(documentation) update swagger documentation

* feat(documentation) update swagger documentation

* feat(documentation) update swagger documentation
  • Loading branch information
Nziranziza authored and kimotho-njoki committed Mar 26, 2019
1 parent 4d98e92 commit 26df362
Show file tree
Hide file tree
Showing 6 changed files with 589 additions and 93 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ Authentication optional, returns a Profile

`POST /api/profiles/:username/follow`

Authentication required, returns a Profile
Authentication required, returns a message

No additional parameters required

### Unfollow user

`DELETE /api/profiles/:username/follow`

Authentication required, returns a Profile
Authentication required, returns a message

No additional parameters required

Expand Down
32 changes: 16 additions & 16 deletions __tests__/routes/comment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('comments', () => {

test('Comment history - This comment was not edited', async done => {
const res = await request(app)
.get(`${urlPrefix}/comments/${newComment.id}/edited`)
.get(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}/edited`)
.set('Authorization', loginUser1.token);
expect(res.status).toBe(404);
expect(res.body.status).toBe(404);
Expand All @@ -193,7 +193,7 @@ describe('comments', () => {
test('UPDATE - should return Bad Request', async done => {
expect.assertions(2);
const res = await request(app)
.put(`${urlPrefix}/comments/${newComment.id}`)
.put(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.send();
expect(res.status).toBe(400);
expect(res.body.errors).toBeDefined();
Expand All @@ -203,7 +203,7 @@ describe('comments', () => {
test('UPDATE - should return No auth token', async done => {
expect.assertions(3);
const res = await request(app)
.put(`${urlPrefix}/comments/${newComment.id}`)
.put(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.send({ comment: { ...createComment } });
expect(res.status).toBe(401);
expect(res.body.comment).toBeUndefined();
Expand All @@ -214,7 +214,7 @@ describe('comments', () => {
test('UPDATE - should return Unauthorized access', async done => {
expect.assertions(3);
const res = await request(app)
.put(`${urlPrefix}/comments/${newComment.id}`)
.put(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.set('Authorization', loginUser2.token)
.send({ comment: { ...createComment } });
expect(res.status).toBe(401);
Expand All @@ -226,7 +226,7 @@ describe('comments', () => {
test('UPDATE - should return internal error', async done => {
expect.assertions(2);
const res = await request(app)
.put(`${urlPrefix}/comments/fake-comment-id`)
.put(`${urlPrefix}/articles/${newArticle.slug}/comments/fake-comment-id`)
.set('Authorization', loginUser1.token)
.send({ comment: { ...createComment } });
expect(res.status).toBe(500);
Expand All @@ -238,7 +238,7 @@ describe('comments', () => {
const commentBody = 'New body';
expect.assertions(3);
const res = await request(app)
.put(`${urlPrefix}/comments/${newArticle.id}`)
.put(`${urlPrefix}/articles/${newArticle.slug}/comments/${newArticle.id}`)
.set('Authorization', loginUser1.token)
.send({ comment: { body: commentBody } });
expect(res.status).toBe(404);
Expand All @@ -251,7 +251,7 @@ describe('comments', () => {
const commentBody = 'New body';
expect.assertions(4);
const res = await request(app)
.put(`${urlPrefix}/comments/${newComment.id}`)
.put(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.set('Authorization', loginUser1.token)
.send({ comment: { body: commentBody } });
newComment = res.body.comment;
Expand All @@ -264,7 +264,7 @@ describe('comments', () => {

test('Comment history - should return old version', async done => {
const res = await request(app)
.get(`${urlPrefix}/comments/${newComment.id}/edited`)
.get(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}/edited`)
.set('Authorization', loginUser1.token);
expect(res.status).toBe(200);
expect(res.body.status).toBe(200);
Expand All @@ -275,7 +275,7 @@ describe('comments', () => {

test('Comment history - should fail to return old version- wrong token', async done => {
const res = await request(app)
.get(`${urlPrefix}/comments/${newComment.id}/edited`)
.get(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}/edited`)
.set('Authorization', loginUser2.token);
expect(res.status).toBe(401);
expect(res.body.status).toBe(401);
Expand All @@ -286,7 +286,7 @@ describe('comments', () => {

test('Comment history - should fail to return old version', async done => {
const res = await request(app)
.get(`${urlPrefix}/comments/0ded7537-c7c2-4d4c-84d8-e941c84e965f/edited`)
.get(`${urlPrefix}/articles/${newArticle.slug}/comments/0ded7537-c7c2-4d4c-84d8-e941c84e965f/edited`)
.set('Authorization', loginUser1.token);
expect(res.status).toBe(404);
expect(res.body.status).toBe(404);
Expand All @@ -298,7 +298,7 @@ describe('comments', () => {
const commentBody = 'New body';
expect.assertions(4);
const res = await request(app)
.put(`${urlPrefix}/comments/${newComment.id}`)
.put(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.set('Authorization', loginUser1.token)
.send({ comment: { body: commentBody } });
newComment = res.body.comment;
Expand All @@ -314,7 +314,7 @@ describe('comments', () => {
test('DELETE - should return No auth token', async done => {
expect.assertions(3);
const res = await request(app)
.delete(`${urlPrefix}/comments/${newComment.id}`)
.delete(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.send({ comment: { ...createComment } });
expect(res.status).toBe(401);
expect(res.body.comment).toBeUndefined();
Expand All @@ -325,7 +325,7 @@ describe('comments', () => {
test('DELETE - should return Unauthorized access', async done => {
expect.assertions(3);
const res = await request(app)
.delete(`${urlPrefix}/comments/${newComment.id}`)
.delete(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.set('Authorization', loginUser2.token)
.send({ comment: { ...createComment } });
expect(res.status).toBe(401);
Expand All @@ -337,7 +337,7 @@ describe('comments', () => {
test('DELETE - should return internal error', async done => {
expect.assertions(2);
const res = await request(app)
.delete(`${urlPrefix}/comments/fake-comment-id`)
.delete(`${urlPrefix}/articles/${newArticle.slug}/comments/fake-comment-id`)
.set('Authorization', loginUser1.token)
.send({ comment: { ...createComment } });
expect(res.status).toBe(500);
Expand All @@ -348,7 +348,7 @@ describe('comments', () => {
test('DELETE - should return Comment not found', async done => {
expect.assertions(3);
const res = await request(app)
.delete(`${urlPrefix}/comments/${newArticle.id}`)
.delete(`${urlPrefix}/articles/${newArticle.slug}/comments/${newArticle.id}`)
.set('Authorization', loginUser1.token)
.send();
expect(res.status).toBe(404);
Expand All @@ -360,7 +360,7 @@ describe('comments', () => {
test('DELETE - should return Comment deleted successfully', async done => {
expect.assertions(3);
const res = await request(app)
.delete(`${urlPrefix}/comments/${newComment.id}`)
.delete(`${urlPrefix}/articles/${newArticle.slug}/comments/${newComment.id}`)
.set('Authorization', loginUser1.token)
.send();
expect(res.status).toBe(200);
Expand Down
Loading

0 comments on commit 26df362

Please sign in to comment.