Merge branch 'master' into e2e-env-fix

This commit is contained in:
Wyatt Johnson
2017-01-26 16:47:52 -07:00
committed by GitHub
36 changed files with 872 additions and 305 deletions
+6 -6
View File
@@ -8,7 +8,7 @@ const embedStreamCommands = {
},
approveComment() {
return this
.waitForElementVisible('@commentList')
.waitForElementVisible('@moderationList')
.waitForElementVisible('@approveButton')
.click('@approveButton');
}
@@ -17,17 +17,17 @@ const embedStreamCommands = {
module.exports = {
commands: [embedStreamCommands],
elements: {
commentList: {
selector: '#commentList'
moderationList: {
selector: '#moderationList'
},
banButton: {
selector: '#commentList .actions:first-child .ban'
selector: '#moderationList .actions:first-child .ban'
},
rejectButton: {
selector: '#commentList .actions:first-child .reject'
selector: '#moderationList .actions:first-child .reject'
},
approveButton: {
selector: '#commentList .actions:first-child .approve'
selector: '#moderationList .actions:first-child .approve'
}
}
};
+24 -2
View File
@@ -62,6 +62,10 @@ describe('/api/v1/queue', () => {
action_type: 'LIKE',
item_id: 'hij',
item_type: 'COMMENTS'
}, {
action_type: 'FLAG',
item_id: '123',
item_type: 'USERS'
}];
beforeEach(() => {
@@ -72,11 +76,16 @@ describe('/api/v1/queue', () => {
comments[1].author_id = u[1].id;
comments[2].author_id = u[1].id;
return Comment.create(comments);
return Promise.all([
Comment.create(comments),
u,
...u.map((user) => UsersService.setStatus(user.id, 'PENDING'))
]);
})
.then((c) => {
.then(([c, u]) => {
actions[0].item_id = c[0].id;
actions[1].item_id = c[1].id;
actions[2].item_id = u[0].id;
return Promise.all([
Action.create(actions),
@@ -98,4 +107,17 @@ describe('/api/v1/queue', () => {
expect(res.body.actions[0]).to.have.property('action_type');
});
});
it('should return all pending users and actions', function(done){
chai.request(app)
.get('/api/v1/queue/users/pending')
.set(passport.inject({roles: ['ADMIN']}))
.end(function(err, res){
expect(err).to.be.null;
expect(res).to.have.status(200);
expect(res.body.users[0]).to.have.property('displayName');
expect(res.body.actions[0]).to.have.property('action_type');
done();
});
});
});
+2 -4
View File
@@ -73,13 +73,11 @@ describe('/api/v1/users/:user_id/actions', () => {
return chai.request(app)
.post('/api/v1/users/abc/actions')
.set(passport.inject({id: '456', roles: ['ADMIN']}))
.send({'action_type': 'flag', metadata: {reason: 'Bio is too awesome.'}})
.send({'action_type': 'FLAG', metadata: {reason: 'Bio is too awesome.'}})
.then((res) => {
expect(res).to.have.status(201);
expect(res).to.have.body;
expect(res.body).to.have.property('action_type', 'flag');
expect(res.body).to.have.property('metadata')
.and.to.deep.equal({'reason': 'Bio is too awesome.'});
expect(res.body).to.have.property('action_type', 'FLAG');
expect(res.body).to.have.property('item_id', 'abc');
});
});