mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57:22 +01:00
@@ -1,6 +1,5 @@
|
||||
import { IncomingWebhook } from '@slack/client';
|
||||
import nconf from 'nconf';
|
||||
import moment from 'moment';
|
||||
import {
|
||||
createAndPopulateGroup,
|
||||
generateUser,
|
||||
@@ -90,32 +89,6 @@ describe('POST /chat', () => {
|
||||
message: t('chatPrivilegesRevoked'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when user is muted with date', async () => {
|
||||
const userWithChatRevoked = await member.update({
|
||||
'flags.chatRevoked': true,
|
||||
'flags.chatRevokedEndDate': moment().add(1, 'days').toDate(),
|
||||
});
|
||||
|
||||
await expect(userWithChatRevoked.post(`/groups/${groupWithChat._id}/chat`, { message: testMessage})).to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('chatPrivilegesRevoked'),
|
||||
});
|
||||
});
|
||||
|
||||
it('allows a user to chat after revoked time has passed', async () => {
|
||||
const userWithChatRevoked = await member.update({
|
||||
'flags.chatRevoked': true,
|
||||
'flags.chatRevokedEndDate': moment().subtract(1, 'days').toDate(),
|
||||
});
|
||||
|
||||
const newMessage = await userWithChatRevoked.post(`/groups/${groupWithChat._id}/chat`, { message: testMessage});
|
||||
const groupMessages = await userWithChatRevoked.get(`/groups/${groupWithChat._id}/chat`);
|
||||
|
||||
expect(newMessage.message.id).to.exist;
|
||||
expect(groupMessages[0].id).to.exist;
|
||||
});
|
||||
});
|
||||
|
||||
context('banned word', () => {
|
||||
|
||||
Reference in New Issue
Block a user