mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
Code cleanup related to old tag services
This commit is contained in:
@@ -219,89 +219,6 @@ describe('services.CommentsService', () => {
|
||||
|
||||
});
|
||||
|
||||
describe('#addTag', () => {
|
||||
it('adds a tag', async () => {
|
||||
const id = comments[0].id;
|
||||
const name = 'BEST';
|
||||
const assigned_by = users[0].id;
|
||||
|
||||
await CommentsService.addTag(id, {
|
||||
tag: {
|
||||
name
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
const {tags} = await CommentsService.findById(id);
|
||||
expect(tags.length).to.equal(1);
|
||||
expect(tags[0].tag.name).to.equal(name);
|
||||
expect(tags[0].assigned_by).to.equal(assigned_by);
|
||||
});
|
||||
|
||||
it('can\'t add same tag.id twice', async () => {
|
||||
const id = comments[0].id;
|
||||
const name = 'BEST';
|
||||
const assigned_by = users[0].id;
|
||||
|
||||
await CommentsService.addTag(id, {
|
||||
tag: {
|
||||
name
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
{
|
||||
let {tags} = await CommentsService.findById(id);
|
||||
expect(tags.length).to.equal(1);
|
||||
}
|
||||
|
||||
await CommentsService.addTag(id, {
|
||||
tag: {
|
||||
name
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
{
|
||||
let {tags} = await CommentsService.findById(id);
|
||||
expect(tags.length).to.equal(1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('#removeTag', () => {
|
||||
it('removes a tag', async () => {
|
||||
const id = comments[0].id;
|
||||
const name = 'BEST';
|
||||
const assigned_by = users[0].id;
|
||||
|
||||
await CommentsService.addTag(id, {
|
||||
tag: {
|
||||
name
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
{
|
||||
const {tags} = await CommentsService.findById(id);
|
||||
expect(tags.length).to.equal(1);
|
||||
}
|
||||
|
||||
// ok now to remove it
|
||||
await CommentsService.removeTag(id, {
|
||||
tag: {
|
||||
name
|
||||
},
|
||||
assigned_by
|
||||
});
|
||||
|
||||
{
|
||||
const {tags} = await CommentsService.findById(id);
|
||||
expect(tags.length).to.equal(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('#changeStatus', () => {
|
||||
|
||||
it('should change the status of a comment from no status', () => {
|
||||
|
||||
Reference in New Issue
Block a user