Skip to content

Commit

Permalink
add test to check standard room to readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
heitortanoue committed Sep 11, 2023
1 parent d4dbb90 commit cc6dda3
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions apps/meteor/tests/end-to-end/api/24-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cc6dda3

Please sign in to comment.