Skip to content

Commit 3d19772

Browse files
committed
chore: enable restrict call access test
1 parent 438a6fa commit 3d19772

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

__tests__/call-types.test.ts

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,31 @@ describe('call types CRUD API', () => {
8181
expect(readResponse.call_types[callTypeName].name).toBe(callTypeName);
8282
});
8383

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-
// });
84+
it('restrict call access', async () => {
85+
let callType = (await client.video.listCallTypes()).call_types[
86+
callTypeName
87+
];
88+
const userGrants = callType.grants['user'].filter(
89+
(c) => c !== VideoOwnCapability.JOIN_CALL,
90+
);
91+
const callMemberGrants = callType.grants['call_member'];
92+
if (!callMemberGrants.includes(VideoOwnCapability.JOIN_CALL)) {
93+
callMemberGrants.push(VideoOwnCapability.JOIN_CALL);
94+
}
95+
96+
await client.video.updateCallType(callTypeName, {
97+
grants: { user: userGrants, call_member: callMemberGrants },
98+
});
99+
100+
callType = (await client.video.listCallTypes()).call_types[callTypeName];
101+
102+
expect(callType.grants.user.includes(VideoOwnCapability.JOIN_CALL)).toBe(
103+
false,
104+
);
105+
expect(
106+
callType.grants.call_member.includes(VideoOwnCapability.JOIN_CALL),
107+
).toBe(true);
108+
});
110109

111110
it('update', async () => {
112111
const updateResponse = await client.video.updateCallType(callTypeName, {

0 commit comments

Comments
 (0)