Skip to content

Commit

Permalink
adds test
Browse files Browse the repository at this point in the history
  • Loading branch information
HBukvic committed Sep 15, 2023
1 parent d839ac3 commit ed459a1
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,35 @@ describe('VideoConferenceService', () => {
});
});

describe('when user has the EXPERT role and an additional role for a course conference', () => {
const setup = () => {
const user: UserDO = userDoFactory
.withRoles([
{ id: new ObjectId().toHexString(), name: RoleName.STUDENT },
{ id: new ObjectId().toHexString(), name: RoleName.EXPERT },
])
.buildWithId();
const userId = user.id as EntityId;
const scopeId = new ObjectId().toHexString();

userService.findById.mockResolvedValue(user);

return {
userId,
scopeId,
};
};

it('should return false', async () => {
const { userId, scopeId } = setup();

const result = await service.hasExpertRole(userId, VideoConferenceScope.COURSE, scopeId);

expect(result).toBe(false);
expect(userService.findById).toHaveBeenCalledWith(userId);
});
});

describe('when conference scope is unknown', () => {
const setup = () => {
const user: UserDO = userDoFactory
Expand Down

0 comments on commit ed459a1

Please sign in to comment.