Skip to content

Commit a35d2bf

Browse files
author
Tim Mendoza
committed
Update e2e tests
1 parent c39c2a9 commit a35d2bf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/e2e/e2e.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,22 @@ describe('the RTC Twilio-CLI Plugin', () => {
140140
expect(room.type).toEqual('group');
141141
});
142142

143+
it('should return a video token without creating a room when the "create_room" flag is false', async () => {
144+
expect.assertions(3);
145+
const ROOM_NAME = nanoid();
146+
const { body } = await superagent
147+
.post(`${URL}/token`)
148+
.send({ passcode, room_name: ROOM_NAME, user_identity: 'test user', create_room: false });
149+
expect(jwt.decode(body.token).grants).toEqual({ identity: 'test user', video: { room: ROOM_NAME } });
150+
expect(body.room_type).toEqual(null);
151+
152+
try {
153+
await twilioClient.video.rooms(ROOM_NAME).fetch();
154+
} catch (e) {
155+
expect(e).toMatchObject({ status: 404 });
156+
}
157+
});
158+
143159
it('should return a 401 error when an incorrect passcode is provided', () => {
144160
superagent
145161
.post(`${URL}/token`)

0 commit comments

Comments
 (0)