Merge branch 'master' into unique-username

This commit is contained in:
Gabriela Rodríguez Berón
2017-01-12 14:53:13 -08:00
committed by GitHub
10 changed files with 148 additions and 126 deletions
+8 -9
View File
@@ -21,6 +21,7 @@ describe('models.Comment', () => {
status_history: [{
type: 'accepted'
}],
status: 'accepted',
parent_id: '',
author_id: '123',
id: '2'
@@ -37,6 +38,7 @@ describe('models.Comment', () => {
status_history: [{
type: 'rejected'
}],
status: 'rejected',
parent_id: '',
author_id: '456',
id: '4'
@@ -46,6 +48,7 @@ describe('models.Comment', () => {
status_history: [{
type: 'premod'
}],
status: 'premod',
parent_id: '',
author_id: '456',
id: '5'
@@ -55,6 +58,7 @@ describe('models.Comment', () => {
status_history: [{
type: 'premod'
}],
status: 'premod',
parent_id: '',
author_id: '456',
id: '6'
@@ -184,20 +188,12 @@ describe('models.Comment', () => {
describe('#moderationQueue()', () => {
it('should find an array of new comments to moderate when pre-moderation', () => {
return Comment.moderationQueue('pre').then((result) => {
return Comment.moderationQueue('premod').then((result) => {
expect(result).to.not.be.null;
expect(result).to.have.lengthOf(2);
});
});
it('should find an array of new comments to moderate when post-moderation', () => {
return Comment.moderationQueue('post').then((result) => {
expect(result).to.not.be.null;
expect(result).to.have.lengthOf(1);
expect(result[0]).to.have.property('body', 'comment 30');
});
});
});
describe('#removeAction', () => {
@@ -227,6 +223,7 @@ describe('models.Comment', () => {
.then(() => Comment.findById(comment_id))
.then((c) => {
expect(c).to.have.property('status');
expect(c.status).to.equal('rejected');
expect(c.status_history).to.have.length(1);
expect(c.status_history[0]).to.have.property('type', 'rejected');
expect(c.status_history[0]).to.have.property('assigned_by', '123');
@@ -238,6 +235,8 @@ describe('models.Comment', () => {
.then(() => Comment.findById(comments[1].id))
.then((c) => {
expect(c).to.have.property('status_history');
expect(c).to.have.property('status');
expect(c.status).to.equal('rejected');
expect(c.status_history).to.have.length(2);
expect(c.status_history[0]).to.have.property('type', 'accepted');
expect(c.status_history[0]).to.have.property('assigned_by', null);
+2
View File
@@ -34,12 +34,14 @@ describe('/api/v1/comments', () => {
body: 'comment 20',
asset_id: 'asset',
author_id: '456',
status: 'rejected',
status_history: [{
type: 'rejected'
}]
}, {
body: 'comment 30',
asset_id: '456',
status: 'accepted',
status_history: [{
type: 'accepted'
}]
+4
View File
@@ -21,6 +21,7 @@ describe('/api/v1/queue', () => {
body: 'comment 10',
asset_id: 'asset',
author_id: '123',
status: 'rejected',
status_history: [{
type: 'rejected'
}]
@@ -29,6 +30,7 @@ describe('/api/v1/queue', () => {
body: 'comment 20',
asset_id: 'asset',
author_id: '456',
status: 'premod',
status_history: [{
type: 'premod'
}]
@@ -36,6 +38,7 @@ describe('/api/v1/queue', () => {
id: 'hij',
body: 'comment 30',
asset_id: '456',
status: 'accepted',
status_history: [{
type: 'accepted'
}]
@@ -89,6 +92,7 @@ describe('/api/v1/queue', () => {
.set(passport.inject({roles: ['admin']}))
.then((res) => {
expect(res).to.have.status(200);
expect(res.body.comments).to.have.length(1);
expect(res.body.comments[0]).to.have.property('body');
expect(res.body.users[0]).to.have.property('displayName');
expect(res.body.actions[0]).to.have.property('action_type');
+4
View File
@@ -29,6 +29,7 @@ describe('/api/v1/stream', () => {
body: 'comment 10',
author_id: '',
parent_id: '',
status: 'accepted',
status_history: [{
type: 'accepted'
}]
@@ -37,6 +38,7 @@ describe('/api/v1/stream', () => {
body: 'comment 20',
author_id: '',
parent_id: '',
status: null,
status_history: []
}, {
id: 'uio',
@@ -44,6 +46,7 @@ describe('/api/v1/stream', () => {
asset_id: 'asset',
author_id: '456',
parent_id: '',
status: 'accepted',
status_history: [{
type: 'accepted'
}]
@@ -51,6 +54,7 @@ describe('/api/v1/stream', () => {
id: 'hij',
body: 'comment 40',
asset_id: '456',
status: 'rejected',
status_history: [{
type: 'rejected'
}]