mirror of
https://github.com/wassname/talk.git
synced 2026-07-08 10:55:00 +08:00
Merge branch 'master' into cookie-updates
This commit is contained in:
+2
-2
@@ -205,8 +205,8 @@ class TagsService {
|
||||
return updateModel(item_type, query, {
|
||||
$pull: {
|
||||
tags: {
|
||||
name: link.tag.name
|
||||
}
|
||||
'tag.name': link.tag.name,
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('services.TagsService', () => {
|
||||
const id = comment.id;
|
||||
const name = 'BEST';
|
||||
const assigned_by = user.id;
|
||||
|
||||
|
||||
await TagsService.add(id, 'COMMENTS', {
|
||||
tag: {
|
||||
name
|
||||
@@ -45,7 +45,7 @@ describe('services.TagsService', () => {
|
||||
const id = comment.id;
|
||||
const name = 'BEST';
|
||||
const assigned_by = user.id;
|
||||
|
||||
|
||||
await TagsService.add(id, 'COMMENTS', {
|
||||
tag: {
|
||||
name
|
||||
@@ -103,5 +103,43 @@ describe('services.TagsService', () => {
|
||||
expect(tags.length).to.equal(0);
|
||||
}
|
||||
});
|
||||
it('removes a tag out of 2', async () => {
|
||||
const id = comment.id;
|
||||
const name = 'BEST';
|
||||
const assigned_by = user.id;
|
||||
|
||||
await TagsService.add(id, 'COMMENTS', {
|
||||
tag: {
|
||||
name: 'ANOTHER'
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
await TagsService.add(id, 'COMMENTS', {
|
||||
tag: {
|
||||
name
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
{
|
||||
const {tags} = await CommentsService.findById(id);
|
||||
expect(tags.length).to.equal(2);
|
||||
}
|
||||
|
||||
// ok now to remove it
|
||||
await TagsService.remove(id, 'COMMENTS', {
|
||||
tag: {
|
||||
name
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
{
|
||||
const {tags} = await CommentsService.findById(id);
|
||||
expect(tags.length).to.equal(1);
|
||||
expect(tags[0].tag.name).to.equal('ANOTHER');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user