-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add getHearingJudgeIds selector and use in JudicialUserSearchResponseResolver * Add judicialResponseUsers to hearing-cancelled-summary/:id route * Align JudicialUserModel with api response * Fix linting errors * Refactor getHearingJudgeIds selector, test for null caseHearings and null hearingDaySchedule * Fix unit test * Fix unit test * Update known security issues * Add unit tests for hearing judges selectors * Fix linting * Fix linting * Fix linting * Add further test scenarios to hearing judges selectors unit tests * Fix linting errors * Remove unused imports * Return empty array if state is undefined, add additional test case * Add additional test case, fix linting errors * Fix linting errors * Fix linting errors * Update yarn audit known security issues * Set jrdELinksV2Enabled to true * Update values.preview.template.yaml * Set "jrdELinksV2Enabled" flag back to false * Update yarn known issues log * remove FEATURE_JRD_E_LINKS_V2_ENABLED flag from preview environment * Update yarn audit known issues log * Update yarn audit known issues log * Update yarn audit known issues log * Add test to check if first member of judicialMemberIds array is null or an empty string * remove focus from test * Increase coverage of unit tests for judicial user search response resolver * Update yarn audit known issues log * Remove focus from unit test * exui-1035-my work returns an error (#3365) * checking userList before makiing call -avoid error * lint error * cve * cve --------- Co-authored-by: RiteshHMCTS <74713687+RiteshHMCTS@users.noreply.github.com> Co-authored-by: Andy Wilkins <49269487+andywilkinshmcts@users.noreply.github.com> Co-authored-by: Ritesh Dsouza <ritesh.dsouza@HMCTS.net>
- Loading branch information
1 parent
2e5713c
commit 8cb5579
Showing
8 changed files
with
190 additions
and
35 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
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
67 changes: 67 additions & 0 deletions
67
src/hearings/store/selectors/hearing-judges.selectors.spec.ts
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { getHearingJudgeIds } from './hearing-judges.selectors'; | ||
import { select, Store, StoreModule } from '@ngrx/store'; | ||
import { reducers, State } from '../reducers'; | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
describe('Hearing Judges selectors', () => { | ||
let store: Store<State>; | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
StoreModule.forRoot({}), | ||
StoreModule.forFeature('hearings', reducers) | ||
] | ||
}); | ||
store = TestBed.inject(Store); | ||
spyOn(store, 'dispatch').and.callThrough(); | ||
}); | ||
|
||
describe('getHearingJudgeIds', () => { | ||
it('should return hearings judge ids state', () => { | ||
let result = null; | ||
store.pipe(select(getHearingJudgeIds)).subscribe((value) => { | ||
result = value; | ||
}); | ||
expect(result).toEqual([]); | ||
}); | ||
it('should return an empty array if state is undefined', () => { | ||
const state = undefined; | ||
const result = getHearingJudgeIds.projector(state); | ||
expect(result).toEqual([]); | ||
}); | ||
it('should return an empty array if hearingList is undefined', () => { | ||
const state = { hearingList: undefined }; | ||
const result = getHearingJudgeIds.projector(state); | ||
expect(result).toEqual([]); | ||
}); | ||
it('should return an empty array if hearingListMainModel is undefined', () => { | ||
const state = { hearingList: { hearingListMainModel: undefined } }; | ||
const result = getHearingJudgeIds.projector(state); | ||
expect(result).toEqual([]); | ||
}); | ||
it('should return an empty array if caseHearings is undefined', () => { | ||
const state = { hearingList: { hearingListMainModel: { caseHearings: undefined } } }; | ||
const result = getHearingJudgeIds.projector(state); | ||
expect(result).toEqual([]); | ||
}); | ||
it('should return an empty array if caseHearings is empty', () => { | ||
const state = { hearingList: { hearingListMainModel: { caseHearings: [] } } }; | ||
const result = getHearingJudgeIds.projector(state); | ||
expect(result).toEqual([]); | ||
}); | ||
it('should return the correct judge ids for each hearing', () => { | ||
const state = { | ||
hearingList: { | ||
hearingListMainModel: { | ||
caseHearings: [ | ||
{ hearingDaySchedule: [{ hearingJudgeId: 1001 }, { hearingJudgeId: 1002 }] }, | ||
{ hearingDaySchedule: [{ hearingJudgeId: 1003 }] } | ||
] | ||
} | ||
} | ||
}; | ||
const result = getHearingJudgeIds.projector(state); | ||
expect(result).toEqual([1001, 1002, 1003]); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { createSelector } from '@ngrx/store'; | ||
import * as fromFeature from '../reducers'; | ||
export const getHearingJudgeIds = createSelector( | ||
fromFeature.getHearingsFeatureState, | ||
(state: fromFeature.State) => { | ||
if (!state) { | ||
return []; | ||
} | ||
const caseHearings = state.hearingList && state.hearingList.hearingListMainModel && state.hearingList.hearingListMainModel.caseHearings || []; | ||
return caseHearings.reduce((acc, caseHearing) => { | ||
if (caseHearing.hearingDaySchedule) { | ||
const judges = caseHearing.hearingDaySchedule.map((schedule) => schedule.hearingJudgeId); | ||
return acc.concat(judges); | ||
} | ||
return acc; | ||
}, []); | ||
} | ||
); |
Large diffs are not rendered by default.
Oops, something went wrong.