mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
Merge branch 'master' into e2e-env-fix
This commit is contained in:
@@ -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'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user