Skip to content

Commit

Permalink
house keeping obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
shaed-parkar committed Dec 12, 2024
1 parent ba58f29 commit 3ffee90
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -900,14 +900,11 @@ describe('HearingControlsBaseComponent', () => {
expect(videoCallService.suspendHearing).not.toHaveBeenCalled();
});

it('should dismiss participant if confirmed leaving and another host is present', done => {
it('should dismiss participant if confirmed leaving and another host is present', () => {
component.displayLeaveHearingPopup = true;
const participantsModel = [];
spyOn(component, 'isAnotherHostInHearing').and.returnValue(true);
videoCallServiceSpy.leaveHearing.and.returnValue(Promise.resolve());
component.leaveHearing.subscribe(event => {
done();
});

component.leave(true, participantsModel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export abstract class HearingControlsBaseComponent implements OnInit, OnDestroy
@Output() public togglePanel = new EventEmitter<string>();
@Output() public changeDeviceToggle = new EventEmitter();
@Output() public changeLanguageSelected = new EventEmitter();
@Output() public leaveHearing = new EventEmitter();

audioOnly = false;

Expand Down Expand Up @@ -459,9 +458,7 @@ export abstract class HearingControlsBaseComponent implements OnInit, OnDestroy
const isAnotherHostInHearing = this.isAnotherHostInHearing(participants);

if (isAnotherHostInHearing) {
this.videoCallService.leaveHearing(this.conferenceId, this.participant.id).then(() => {
this.leaveHearing.emit();
});
this.videoCallService.leaveHearing(this.conferenceId, this.participant.id);
} else {
this.videoCallService.suspendHearing(this.conferenceId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ <h1 #roomTitleLabel class="room-title-label">{{ getCaseNameAndNumber() }}</h1>
[areParticipantsVisible]="areParticipantsVisible"
(leaveConsultation)="leaveConsultation()"
(togglePanel)="togglePanel($event)"
(changeDeviceToggle)="showChooseCameraDialog()"
(leaveHearing)="leaveHearing()">
(changeDeviceToggle)="showChooseCameraDialog()">
[conference]="conference">
</app-private-consultation-room-controls>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
flush();

expect(videoCallService.startHearing).toHaveBeenCalledWith(component.conference.id, layout);
expect(component.hostWantsToJoinHearing).toBeTrue();
}));

it('should handle api error when start hearing fails', async () => {
Expand All @@ -498,7 +497,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
await component.joinHearingInSession();

expect(videoCallService.joinHearingInSession).toHaveBeenCalledWith(component.conferenceId, component.participant.id);
expect(component.shouldCurrentUserJoinHearing()).toBeTrue();
});

describe('Audio recording and alert notifications', () => {
Expand Down Expand Up @@ -617,7 +615,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
// Assert
expect(component.displayConfirmStartHearingPopup).toBeFalsy();
expect(videoCallService.startHearing).toHaveBeenCalledOnceWith(hearingId, hearingLayout);
expect(component.hostWantsToJoinHearing).toBeTrue();
}));

it('should not enable IM when hearing has not been initalised', () => {
Expand Down Expand Up @@ -660,15 +657,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
expect(component.conferenceStartedBy).toBe(null);
}));

it('should set shouldUpdateHostShowVideo to false when participant not connecting to pexip', async () => {
component.hostWantsToJoinHearing = true;
component.connected = false;

component.updateShowVideo();

expect(component.hostWantsToJoinHearing).toBeFalse();
});

it('should not pull the STAFFMEMBER in to the hearing when STAFFMEMBER is in Waiting Room and hearing started by the JUDGE', () => {
component.ngOnInit();
component.connected = true;
Expand All @@ -689,7 +677,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
component.conferenceStartedBy = component.conference.participants.find(p => p.role === Role.StaffMember).id;
component.participant = component.conference.participants.find(p => p.role === Role.StaffMember);
component.participant.status = ParticipantStatus.InHearing;
component.hostWantsToJoinHearing = true;
component.updateShowVideo();

expect(component.hearing.isInSession()).toBeTrue();
Expand All @@ -709,7 +696,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
component.conferenceStartedBy = component.conference.participants.find(p => p.role === Role.StaffMember).id;
component.participant = component.conference.participants.find(p => p.role === Role.StaffMember);
component.participant.status = ParticipantStatus.InConsultation;
component.hostWantsToJoinHearing = false;
component.updateShowVideo();

expect(component.hearing.isInSession()).toBeFalse();
Expand Down Expand Up @@ -994,38 +980,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
});
});

describe('shouldUnmuteForHearing', () => {
let superShouldUnmuteForHearing: jasmine.SpyObj<any>;

beforeEach(() => {
superShouldUnmuteForHearing = spyOn(WaitingRoomBaseDirective.prototype, 'shouldUnmuteForHearing');
});

it('should return false when super.shouldUnmuteForHearing is false hostWantsToJoinHearing is false', () => {
superShouldUnmuteForHearing.and.returnValue(false);
component.hostWantsToJoinHearing = false;
expect(component.shouldUnmuteForHearing()).toBe(false);
});

it('should return false when super.shouldUnmuteForHearing is false hostWantsToJoinHearing is true', () => {
superShouldUnmuteForHearing.and.returnValue(false);
component.hostWantsToJoinHearing = true;
expect(component.shouldUnmuteForHearing()).toBe(false);
});

it('should return false when super.shouldUnmuteForHearing is true hostWantsToJoinHearing is false', () => {
superShouldUnmuteForHearing.and.returnValue(true);
component.hostWantsToJoinHearing = false;
expect(component.shouldUnmuteForHearing()).toBe(false);
});

it('should return true when super.shouldUnmuteForHearing is true hostWantsToJoinHearing is true', () => {
superShouldUnmuteForHearing.and.returnValue(true);
component.hostWantsToJoinHearing = true;
expect(component.shouldUnmuteForHearing()).toBe(true);
});
});

describe('updateSpotlightStateOnParticipantDisconnectDuringConference', () => {
it('should do nothing if the conference is not in session', () => {
// Arrange
Expand Down Expand Up @@ -1128,11 +1082,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
// Assert
expect(videoControlCacheServiceSpy.setSpotlightStatus).toHaveBeenCalledOnceWith(participant.id, false);
});

it('should return hostWantsToJoinHearing false when leave hearing button has been clicked', () => {
component.leaveHearing();
expect(component.hostWantsToJoinHearing).toBeFalse();
});
});

describe('joinHearingClicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import { ConferenceState } from '../store/reducers/conference.reducer';
import { LaunchDarklyService } from '../../services/launch-darkly.service';
import { AudioRecordingService } from '../../services/audio-recording.service';
import { getCountdownComplete } from '../store/selectors/conference.selectors';
import { HearingTransfer, TransferDirection } from 'src/app/services/models/hearing-transfer';

@Component({
selector: 'app-judge-waiting-room',
Expand All @@ -52,7 +51,6 @@ import { HearingTransfer, TransferDirection } from 'src/app/services/models/hear
export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implements OnDestroy, OnInit {
continueWithNoRecording = false;
expanedPanel = true;
hostWantsToJoinHearing = false;
displayConfirmStartHearingPopup: boolean;
displayJoinHearingPopup: boolean;

Expand Down Expand Up @@ -326,7 +324,6 @@ export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implemen

this.hearingLayoutService.currentLayout$.pipe(take(1)).subscribe(async layout => {
try {
this.hostWantsToJoinHearing = true;
await this.videoCallService.startHearing(this.hearing.id, layout);
} catch (err) {
this.logger.error(`${this.loggerPrefixJudge} Failed to ${action} a hearing for conference`, err, {
Expand Down Expand Up @@ -365,17 +362,11 @@ export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implemen
}

async joinHearingInSession() {
this.hostWantsToJoinHearing = true;
await this.videoCallService.joinHearingInSession(this.conferenceId, this.participant.id);
}

shouldCurrentUserJoinHearing(): boolean {
return this.participant.status === ParticipantStatus.InHearing || this.hostWantsToJoinHearing;
}

resetVideoFlags() {
super.resetVideoFlags();
this.hostWantsToJoinHearing = false;
return this.participant.status === ParticipantStatus.InHearing;
}

audioRestartCallback(continueWithNoRecording: boolean) {
Expand Down Expand Up @@ -428,14 +419,6 @@ export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implemen
}
}

leaveHearing() {
this.hostWantsToJoinHearing = false;
}

shouldUnmuteForHearing(): boolean {
return super.shouldUnmuteForHearing() && this.hostWantsToJoinHearing;
}

setTrapFocus() {
ModalTrapFocus.trap('video-container');
}
Expand Down Expand Up @@ -570,11 +553,6 @@ export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implemen
});
}

handleHearingTransferChange(message: HearingTransfer) {
super.handleHearingTransferChange(message);
this.hostWantsToJoinHearing = message.participantId === this.participant.id && message.transferDirection === TransferDirection.In;
}

private onShouldReload(): void {
window.location.reload();
}
Expand Down

0 comments on commit 3ffee90

Please sign in to comment.