Adds privacy type to the methods to add tags.

This commit is contained in:
gaba
2017-04-21 14:30:41 -07:00
parent 0a4fd15fa2
commit c4ffe58f58
8 changed files with 29 additions and 28 deletions
+4 -4
View File
@@ -16,8 +16,8 @@ describe('graph.mutations.addCommentTag', () => {
});
const query = `
mutation AddCommentTag ($id: ID!, $tag: String!) {
addCommentTag(id:$id, tag:$tag) {
mutation AddCommentTag ($id: ID!, $tag: String!, $privacy_type: String!) {
addCommentTag(id:$id, tag:$tag, privacy_type:$privacy_type) {
comment {
id
}
@@ -31,7 +31,7 @@ describe('graph.mutations.addCommentTag', () => {
it('moderators can add tags to comments', async () => {
const user = new UserModel({roles: ['MODERATOR' ]});
const context = new Context({user});
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST', privacy_type: 'PUBLIC'});
if (response.errors && response.errors.length) {
console.error(response.errors);
}
@@ -51,7 +51,7 @@ describe('graph.mutations.addCommentTag', () => {
}).forEach(([ userDescription, user ]) => {
it(userDescription, async function () {
const context = new Context({user});
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST', privacy_type: 'PUBLIC'});
if (response.errors && response.errors.length) {
console.error(response.errors);
}
@@ -34,7 +34,7 @@ describe('graph.mutations.removeCommentTag', () => {
const context = new Context({user});
// add a tag first
await CommentsService.addTag(comment.id, 'BEST');
await CommentsService.addTag(comment.id, 'BEST', user.id, 'PUBLIC');
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
if (response.errors && response.errors.length) {
console.error(response.errors);
@@ -59,7 +59,7 @@ describe('graph.mutations.removeCommentTag', () => {
const context = new Context({user});
// add a tag first
await CommentsService.addTag(comment.id, 'BEST');
await CommentsService.addTag(comment.id, 'BEST', user ? user.id : null, 'PUBLIC');
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
if (response.errors && response.errors.length) {
console.error(response.errors);