|
|
|
|
@ -1573,25 +1573,49 @@ describe('[Channels]', function () { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('/channels.setDefault', async () => { |
|
|
|
|
const roomInfo = await getRoomInfo(channel._id); |
|
|
|
|
describe('/channels.setDefault', () => { |
|
|
|
|
it('should set channel as default', async () => { |
|
|
|
|
const roomInfo = await getRoomInfo(channel._id); |
|
|
|
|
|
|
|
|
|
return request |
|
|
|
|
.post(api('channels.setDefault')) |
|
|
|
|
.set(credentials) |
|
|
|
|
.send({ |
|
|
|
|
roomId: channel._id, |
|
|
|
|
default: true, |
|
|
|
|
}) |
|
|
|
|
.expect('Content-Type', 'application/json') |
|
|
|
|
.expect(200) |
|
|
|
|
.expect((res) => { |
|
|
|
|
expect(res.body).to.have.property('success', true); |
|
|
|
|
expect(res.body).to.have.nested.property('channel._id'); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.name', `EDITED${apiPublicChannelName}`); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.t', 'c'); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.msgs', roomInfo.channel.msgs); |
|
|
|
|
}); |
|
|
|
|
return request |
|
|
|
|
.post(api('channels.setDefault')) |
|
|
|
|
.set(credentials) |
|
|
|
|
.send({ |
|
|
|
|
roomId: channel._id, |
|
|
|
|
default: true, |
|
|
|
|
}) |
|
|
|
|
.expect('Content-Type', 'application/json') |
|
|
|
|
.expect(200) |
|
|
|
|
.expect((res) => { |
|
|
|
|
expect(res.body).to.have.property('success', true); |
|
|
|
|
expect(res.body).to.have.nested.property('channel._id'); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.name', `EDITED${apiPublicChannelName}`); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.t', 'c'); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.msgs', roomInfo.channel.msgs); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.default', true); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
it('should unset channel as default', async () => { |
|
|
|
|
const roomInfo = await getRoomInfo(channel._id); |
|
|
|
|
|
|
|
|
|
return request |
|
|
|
|
.post(api('channels.setDefault')) |
|
|
|
|
.set(credentials) |
|
|
|
|
.send({ |
|
|
|
|
roomId: channel._id, |
|
|
|
|
default: false, |
|
|
|
|
}) |
|
|
|
|
.expect('Content-Type', 'application/json') |
|
|
|
|
.expect(200) |
|
|
|
|
.expect((res) => { |
|
|
|
|
expect(res.body).to.have.property('success', true); |
|
|
|
|
expect(res.body).to.have.nested.property('channel._id'); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.name', `EDITED${apiPublicChannelName}`); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.t', 'c'); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.msgs', roomInfo.channel.msgs); |
|
|
|
|
expect(res.body).to.have.nested.property('channel.default', false); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('/channels.leave', async () => { |
|
|
|
|
|