Skip to content

Commit 438a6fa

Browse files
authored
chore: add test for restricting call access (#14)
1 parent e79f53c commit 438a6fa

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

__tests__/call-types.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ describe('call types CRUD API', () => {
4848
VideoOwnCapability.SEND_VIDEO,
4949
VideoOwnCapability.MUTE_USERS,
5050
],
51-
user: [VideoOwnCapability.SEND_AUDIO, VideoOwnCapability.SEND_VIDEO],
5251
},
5352
});
5453

@@ -82,6 +81,33 @@ describe('call types CRUD API', () => {
8281
expect(readResponse.call_types[callTypeName].name).toBe(callTypeName);
8382
});
8483

84+
// TODO: fix backend error
85+
// it('restrict call access', async () => {
86+
// let callType = (await client.video.listCallTypes()).call_types[
87+
// callTypeName
88+
// ];
89+
// const userGrants = callType.grants['user'].filter(
90+
// (c) => c !== VideoOwnCapability.JOIN_CALL,
91+
// );
92+
// const callMemberGrants = callType.grants['call_member'];
93+
// if (!callMemberGrants.includes(VideoOwnCapability.JOIN_CALL)) {
94+
// callMemberGrants.push(VideoOwnCapability.JOIN_CALL);
95+
// }
96+
97+
// await client.video.updateCallType(callTypeName, {
98+
// grants: { call_member: callMemberGrants },
99+
// });
100+
101+
// callType = (await client.video.listCallTypes()).call_types[callTypeName];
102+
103+
// expect(callType.grants.user.includes(VideoOwnCapability.JOIN_CALL)).toBe(
104+
// false,
105+
// );
106+
// expect(
107+
// callType.grants.call_member.includes(VideoOwnCapability.JOIN_CALL),
108+
// ).toBe(true);
109+
// });
110+
85111
it('update', async () => {
86112
const updateResponse = await client.video.updateCallType(callTypeName, {
87113
settings: {

0 commit comments

Comments
 (0)