Skip to content

Commit

Permalink
swap to use api v2 toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaed Parkar committed Nov 2, 2023
1 parent 48249a7 commit fd5cbe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('AssignJudgeComponent', () => {
emailValidationServiceSpy.validateEmail.and.returnValue(true);
emailValidationServiceSpy.hasCourtroomAccountPattern.and.returnValue(true);
launchDarklyServiceSpy.getFlag.withArgs(FeatureFlags.eJudFeature).and.returnValue(of(true));
launchDarklyServiceSpy.getFlag.withArgs(FeatureFlags.referenceData).and.returnValue(of(false));
launchDarklyServiceSpy.getFlag.withArgs(FeatureFlags.useV2Api).and.returnValue(of(false));

bookingServiseSpy = jasmine.createSpyObj<BookingService>('BookingService', ['resetEditMode', 'isEditMode', 'removeEditMode']);

Expand Down Expand Up @@ -613,7 +613,7 @@ describe('AssignJudgeComponent', () => {
const updatedJudgeDisplayName = 'UpdatedJudgeDisplayName';
videoHearingsServiceSpy.canAddJudge.and.returnValue(true);
component.judge.display_name = updatedJudgeDisplayName;
component.referenceDataFeatureFlag = false;
component.useV2Api = false;
});

it('should add judge account when none present', () => {
Expand All @@ -625,7 +625,7 @@ describe('AssignJudgeComponent', () => {
});

it('should add update judge when reference data flag is on', () => {
component.referenceDataFeatureFlag = true;
component.useV2Api = true;
});
afterEach(() => {
component.updateJudge(judge);
Expand All @@ -636,7 +636,7 @@ describe('AssignJudgeComponent', () => {
expect(component.courtAccountJudgeEmail).toEqual(judge.username);
expect(component.judgeDisplayNameFld.value).toEqual(judge.display_name);
expect(updatedJudges[0]).toBe(judge);
if (component.referenceDataFeatureFlag) {
if (component.useV2Api) {
expect(updatedJudges[0].case_role_name).toBeNull();
expect(updatedJudges[0].hearing_role_code).toBe(Constants.HearingRoleCodes.Judge);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AssignJudgeComponent extends BookingBaseComponent implements OnInit
isValidEmail = true;
showStaffMemberFeature: boolean;
ejudFeatureFlag = false;
referenceDataFeatureFlag = false;
useV2Api = false;
destroyed$ = new Subject<void>();

constructor(
Expand All @@ -69,10 +69,10 @@ export class AssignJudgeComponent extends BookingBaseComponent implements OnInit

ngOnInit() {
this.launchDarklyService
.getFlag<boolean>(FeatureFlags.referenceData)
.getFlag<boolean>(FeatureFlags.useV2Api)
.pipe(takeUntil(this.destroyed$))
.subscribe(enabled => {
this.referenceDataFeatureFlag = enabled;
this.useV2Api = enabled;
});
this.launchDarklyService
.getFlag<boolean>(FeatureFlags.eJudFeature)
Expand Down Expand Up @@ -381,7 +381,7 @@ export class AssignJudgeComponent extends BookingBaseComponent implements OnInit
if (this.hearingService.canAddJudge(judge.username)) {
judge.is_judge = true;
judge.case_role_name = 'Judge';
if (this.referenceDataFeatureFlag) {
if (this.useV2Api) {
judge.case_role_name = null;
judge.hearing_role_code = Constants.HearingRoleCodes.Judge;
}
Expand Down

0 comments on commit fd5cbe9

Please sign in to comment.