-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shaed Parkar
committed
Nov 7, 2023
1 parent
e9fe8cb
commit 20478ca
Showing
18 changed files
with
250 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
using AdminWebsite.UnitTests.Helper; | ||
using BookingsApi.Client; | ||
using BookingsApi.Contract.V1.Requests; | ||
using BookingsApi.Contract.V1.Requests.Enums; | ||
using BookingsApi.Contract.V1.Responses; | ||
using BookingsApi.Contract.V2.Enums; | ||
using BookingsApi.Contract.V2.Requests; | ||
|
@@ -32,6 +33,7 @@ | |
using BookingStatus = BookingsApi.Contract.V1.Enums.BookingStatus; | ||
using CaseResponse = BookingsApi.Contract.V1.Responses.CaseResponse; | ||
using EndpointResponse = BookingsApi.Contract.V1.Responses.EndpointResponse; | ||
using JudiciaryParticipantRequest = AdminWebsite.Contracts.Requests.JudiciaryParticipantRequest; | ||
using LinkedParticipantResponse = BookingsApi.Contract.V1.Responses.LinkedParticipantResponse; | ||
using LinkedParticipantType = BookingsApi.Contract.V1.Enums.LinkedParticipantType; | ||
|
||
|
@@ -358,6 +360,11 @@ public void Setup() | |
Pin = "pin", | ||
Sip = "sip" | ||
} | ||
}, | ||
JudiciaryParticipants = new List<JudiciaryParticipantResponse>() | ||
{ | ||
new (){FullName = "Judge Fudge", FirstName = "John", LastName = "Doe", HearingRoleCode = JudiciaryParticipantHearingRoleCode.Judge, PersonalCode = "1234"}, | ||
new (){FullName = "Jane Doe", FirstName = "Jane", LastName = "Doe", HearingRoleCode = JudiciaryParticipantHearingRoleCode.PanelMember, PersonalCode = "4567"} | ||
} | ||
}; | ||
} | ||
|
@@ -605,15 +612,36 @@ public async Task Should_return_updated_hearingV2() | |
LinkedParticipantContactEmail = "[email protected]", | ||
Type = AdminWebsite.Contracts.Enums.LinkedParticipantType.Interpreter | ||
} | ||
} | ||
}, | ||
}); | ||
_addNewParticipantRequest.JudiciaryParticipants = new List<JudiciaryParticipantRequest>() | ||
{ | ||
new() | ||
{ | ||
PersonalCode = "4567", DisplayName = "Jane Doe 2", Role = JudiciaryParticipantHearingRoleCode.PanelMember.ToString() | ||
}, | ||
new() | ||
{ | ||
PersonalCode = "5678", DisplayName = "New Judge Fudge", Role = JudiciaryParticipantHearingRoleCode.Judge.ToString() | ||
} | ||
}; | ||
var result = await _controller.EditHearing(_validId, _addNewParticipantRequest); | ||
var hearing = (AdminWebsite.Contracts.Responses.HearingDetailsResponse)((OkObjectResult)result.Result).Value; | ||
hearing.Id.Should().Be(updatedHearing.Id); | ||
_bookingsApiClient.Verify(x => x.UpdateHearingDetails2Async(It.IsAny<Guid>(), | ||
It.Is<UpdateHearingRequestV2>(u => | ||
!u.Cases.IsNullOrEmpty())), | ||
Times.Once); | ||
|
||
_bookingsApiClient.Verify(x => x.RemoveJudiciaryParticipantFromHearingAsync(hearing.Id, "1234"), | ||
Times.Once); | ||
|
||
_bookingsApiClient.Verify(x => x.UpdateJudiciaryParticipantAsync(hearing.Id, "4567", It.IsAny<UpdateJudiciaryParticipantRequest>()), | ||
Times.Once); | ||
|
||
_bookingsApiClient.Verify( | ||
x => x.AddJudiciaryParticipantsToHearingAsync(hearing.Id, | ||
It.IsAny<IEnumerable<BookingsApi.Contract.V1.Requests.JudiciaryParticipantRequest>>()), Times.Once); | ||
} | ||
|
||
[Test] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ import { | |
LinkedParticipantResponse, | ||
BookingStatus, | ||
AllocatedCsoResponse, | ||
JusticeUserResponse | ||
JusticeUserResponse, | ||
JudiciaryParticipantResponse | ||
} from './clients/api-client'; | ||
import { HearingModel } from '../common/model/hearing.model'; | ||
import { CaseModel } from '../common/model/case.model'; | ||
|
@@ -201,6 +202,19 @@ describe('Video hearing service', () => { | |
model.other_information = 'note'; | ||
model.cases = [caseModel]; | ||
model.participants = []; | ||
model.judiciary_participants = [ | ||
new JudiciaryParticipantResponse({ | ||
title: 'Mr', | ||
first_name: 'Dan', | ||
last_name: 'Smith', | ||
display_name: 'Judge Dan Smith', | ||
email: '[email protected]', | ||
full_name: 'Dan Smith', | ||
personal_code: '1234', | ||
work_phone: '123123123', | ||
role_code: 'Judge' | ||
}) | ||
]; | ||
model.audio_recording_required = true; | ||
|
||
const request = service.mapHearingDetailsResponseToHearingModel(model); | ||
|
@@ -215,6 +229,8 @@ describe('Video hearing service', () => { | |
expect(request.scheduled_date_time).toEqual(new Date(date)); | ||
expect(request.scheduled_duration).toBe(30); | ||
expect(request.audio_recording_required).toBeTruthy(); | ||
expect(request.judiciaryParticipants[0]).toBeTruthy(); | ||
expect(request.judiciaryParticipants[0].displayName).toBe('Judge Dan Smith'); | ||
}); | ||
|
||
it('should map ParticipantResponse to ParticipantModel', () => { | ||
|
Oops, something went wrong.