From cc6dda309cc6f7117147c2b43a343f347c78584f Mon Sep 17 00:00:00 2001 From: Heitor Tanoue Date: Mon, 11 Sep 2023 17:53:04 -0300 Subject: [PATCH] add test to check standard room to readonly --- .../meteor/tests/end-to-end/api/24-methods.js | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/apps/meteor/tests/end-to-end/api/24-methods.js b/apps/meteor/tests/end-to-end/api/24-methods.js index da506005f87f..2f3beac4af65 100644 --- a/apps/meteor/tests/end-to-end/api/24-methods.js +++ b/apps/meteor/tests/end-to-end/api/24-methods.js @@ -2422,7 +2422,7 @@ describe('Meteor.methods', function () { describe('-> standard room', () => { describe('- when muting a user in a standard room', () => { - it('should mute a user in a standard room', async () => { + it('should mute an user in a standard room', async () => { await request .post(methodCall('muteUserInRoom')) .set(credentials) @@ -2467,7 +2467,7 @@ describe('Meteor.methods', function () { }); describe('- when unmuting a user in a standard room', () => { - it('should unmute a user in a standard room', async () => { + it('should unmute an user in a standard room', async () => { await request .post(methodCall('unmuteUserInRoom')) .set(credentials) @@ -2523,8 +2523,27 @@ describe('Meteor.methods', function () { .expect(200); }); + it('should not allow an user to send messages', async () => { + await request + .post(api('chat.sendMessage')) + .set(testUserCredentials) + .send({ + message: { + msg: 'Sample message', + rid, + }, + }) + .expect('Content-Type', 'application/json') + .expect(400) + .expect((res) => { + expect(res.body).to.have.property('success', false); + expect(res.body).to.have.property('error').that.is.a('string'); + expect(res.body.error).to.equal('You_cannot_send_messages_to_read_only_channels'); + }); + }); + describe('- when unmuting a user in a read-only room', () => { - it('should unmute a user in a read-only room', async () => { + it('should unmute an user in a read-only room', async () => { await request .post(methodCall('unmuteUserInRoom')) .set(credentials) @@ -2567,7 +2586,7 @@ describe('Meteor.methods', function () { }); describe('- when muting a user in a read-only room', () => { - it('should mute a user in a read-only room', async () => { + it('should mute an user in a read-only room', async () => { await request .post(methodCall('muteUserInRoom')) .set(credentials)