removed events

This commit is contained in:
Wyatt Johnson
2018-01-29 16:36:54 -07:00
parent 73cbe4ab4b
commit a06f76fd4c
12 changed files with 121 additions and 531 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ const { graphql } = require('graphql');
const schema = require('../../../../graph/schema');
const Context = require('../../../../graph/context');
const AssetModel = require('../../../../models/asset');
const CommentModel = require('../../../../models/comment');
const UserModel = require('../../../../models/user');
const SettingsService = require('../../../../services/settings');
const CommentsService = require('../../../../services/comments');
@@ -50,7 +51,7 @@ describe('graph.mutations.addTag', () => {
expect(res.errors).to.be.empty;
let { tags } = await CommentsService.findById(comment.id);
let { tags } = await CommentModel.findOne({ id: comment.id });
expect(tags).to.have.length(1);
});
+6 -6
View File
@@ -3,12 +3,12 @@ const { graphql } = require('graphql');
const schema = require('../../../../graph/schema');
const Context = require('../../../../graph/context');
const UserModel = require('../../../../models/user');
const AssetModel = require('../../../../models/asset');
const ActionModel = require('../../../../models/action');
const AssetModel = require('../../../../models/asset');
const CommentModel = require('../../../../models/comment');
const UserModel = require('../../../../models/user');
const SettingsService = require('../../../../services/settings');
const CommentsService = require('../../../../services/comments');
const { expect } = require('chai');
@@ -293,9 +293,9 @@ describe('graph.mutations.createComment', () => {
expect(data.createComment).to.have.property('comment').not.null;
expect(data.createComment).to.have.property('errors').null;
const { tags } = await CommentsService.findById(
data.createComment.comment.id
);
const { tags } = await CommentModel.findOne({
id: data.createComment.comment.id,
});
if (tag) {
expect(tags).to.have.length(1);
expect(tags[0].tag.name).to.have.equal(tag);
+9 -8
View File
@@ -1,12 +1,13 @@
const { graphql } = require('graphql');
const timekeeper = require('timekeeper');
const schema = require('../../../../graph/schema');
const Context = require('../../../../graph/context');
const UsersService = require('../../../../services/users');
const AssetModel = require('../../../../models/asset');
const SettingsService = require('../../../../services/settings');
const CommentModel = require('../../../../models/comment');
const CommentsService = require('../../../../services/comments');
const Context = require('../../../../graph/context');
const schema = require('../../../../graph/schema');
const SettingsService = require('../../../../services/settings');
const UsersService = require('../../../../services/users');
const { expect } = require('chai');
@@ -70,7 +71,7 @@ describe('graph.mutations.editComment', () => {
expect(response.data.editComment.errors).to.be.null;
// assert body has changed
const commentAfterEdit = await CommentsService.findById(comment.id);
const commentAfterEdit = await CommentModel.findOne({ id: comment.id });
expect(commentAfterEdit.body).to.equal(newBody);
expect(commentAfterEdit.body_history).to.be.instanceOf(Array);
expect(commentAfterEdit.body_history.length).to.equal(2);
@@ -110,7 +111,7 @@ describe('graph.mutations.editComment', () => {
expect(response.data.editComment.errors[0].translation_key).to.equal(
'EDIT_WINDOW_ENDED'
);
const commentAfterEdit = await CommentsService.findById(comment.id);
const commentAfterEdit = await CommentModel.findOne({ id: comment.id });
// it *hasn't* changed from the original
expect(commentAfterEdit.body).to.equal(comment.body);
@@ -142,7 +143,7 @@ describe('graph.mutations.editComment', () => {
expect(response.data.editComment.errors[0].translation_key).to.equal(
'NOT_AUTHORIZED'
);
const commentAfterEdit = await CommentsService.findById(comment.id);
const commentAfterEdit = await CommentModel.findOne({ id: comment.id });
// it *hasn't* changed from the original
expect(commentAfterEdit.body).to.equal(comment.body);
@@ -274,7 +275,7 @@ describe('graph.mutations.editComment', () => {
console.error(response.data.editComment.errors);
}
expect(response.data.editComment.errors).to.be.null;
const commentAfterEdit = await CommentsService.findById(comment.id);
const commentAfterEdit = await CommentModel.findOne({ id: comment.id });
expect(commentAfterEdit.body).to.equal(newBody);
expect(commentAfterEdit.status).to.equal(afterEdit.status);
}
+3 -2
View File
@@ -6,8 +6,9 @@ const UserModel = require('../../../../models/user');
const SettingModel = require('../../../../models/setting');
const AssetModel = require('../../../../models/asset');
const SettingsService = require('../../../../services/settings');
const CommentModel = require('../../../../models/comment');
const CommentsService = require('../../../../services/comments');
const SettingsService = require('../../../../services/settings');
const TagsService = require('../../../../services/tags');
const { expect } = require('chai');
@@ -59,7 +60,7 @@ describe('graph.mutations.removeTag', () => {
expect(response.errors).to.be.empty;
expect(response.data.removeTag).to.be.null;
let retrievedComment = await CommentsService.findById(comment.id);
let retrievedComment = await CommentModel.findOne({ id: comment.id });
expect(retrievedComment.tags).to.have.length(0);
});