mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fix: assertion check to ensure messages are in the room when editing/deleting, etc
This commit is contained in:
@@ -628,6 +628,12 @@ describe('Messaging Library', () => {
|
||||
assert.strictEqual(body.status.message, await translator.translate('[[error:cant-edit-chat-message]]'));
|
||||
});
|
||||
|
||||
it('should fail to edit message if message not in room', async () => {
|
||||
const { statusCode, body } = await callv3API('put', `/chats/${roomId}/messages/1014`, { message: 'message edited' }, 'herp');
|
||||
assert.strictEqual(statusCode, 400);
|
||||
assert.strictEqual(body.status.message, await translator.translate('[[error:invalid-mid]]'));
|
||||
});
|
||||
|
||||
it('should edit message', async () => {
|
||||
let { statusCode, body } = await callv3API('put', `/chats/${roomId}/messages/${mid}`, { message: 'message edited' }, 'foo');
|
||||
assert.strictEqual(statusCode, 200);
|
||||
|
||||
Reference in New Issue
Block a user