The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/tests/data/chat.helper.js

32 lines
702 B

import { api, credentials, request } from './api-data';
export const sendSimpleMessage = ({ roomId, text = 'test message' }) => {
if (!roomId) {
throw new Error('"roomId" is required in "sendSimpleMessage" test helper');
}
return request.post(api('chat.sendMessage'))
.set(credentials)
.send({
message: {
rid: roomId,
text,
},
});
};
export const deleteMessage = ({ roomId, msgId }) => {
if (!roomId) {
throw new Error('"roomId" is required in "deleteMessage" test helper');
}
if (!msgId) {
throw new Error('"msgId" is required in "deleteMessage" test helper');
}
return request.post(api('chat.delete'))
.set(credentials)
.send({
roomId,
msgId,
});
};