Skip to content

Commit e22036b

Browse files
author
Dan Carbonell
committed
add test for client role moderator
1 parent c9e9341 commit e22036b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/components/Message/__tests__/Message.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,19 @@ describe('<Message /> component', () => {
513513
expect(getMessageActions()).toContain(MESSAGE_ACTIONS.delete);
514514
});
515515

516+
it('should allow user to edit and delete message when moderator role is set on client', async () => {
517+
const amin = generateUser({
518+
name: 'amin',
519+
role: 'channel_moderator',
520+
});
521+
const client = await getTestClientWithUser(amin);
522+
const message = generateMessage({ user: bob });
523+
await renderComponent(message, {}, { client });
524+
const { getMessageActions } = getRenderedProps();
525+
expect(getMessageActions()).toContain(MESSAGE_ACTIONS.edit);
526+
expect(getMessageActions()).toContain(MESSAGE_ACTIONS.delete);
527+
});
528+
516529
it('should allow user to edit and delete message when user is admin', async () => {
517530
const message = generateMessage({ user: bob });
518531
await renderComponent(

0 commit comments

Comments
 (0)