Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.2.50",
"version": "7.2.50-error-trigger-nav",
"engines": {
"node": ">=18.19.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.2.50",
"version": "7.2.50-error-trigger-nav",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,33 @@ describe('EventTriggerResolver', () => {
expect(err).toBeTruthy();
expect(alertService.setPreserveAlerts).toHaveBeenCalledWith(true);
expect(alertService.error).toHaveBeenCalledWith(ERROR.message);
expect(router.navigate).toHaveBeenCalled();
expect(router.navigate).toHaveBeenCalledWith([`/cases/case-details/${CASE_ID}/tasks`]);
done();
});
expect(profileService.get).toHaveBeenCalledWith();
});

it('should not navigate to tasks on error if url is present', done => {
casesService.getEventTrigger.and.returnValue(throwError(ERROR));
profileService.get.and.returnValue(PROFILE_OBS);
router.url = '/cases/case-details/';

eventTriggerResolver
.resolve(route)
.then(data => {
fail(data);
}, err => {
err.details = { eventId: 'createBundle', ...err.details };
expect(err).toBeTruthy();
expect(alertService.setPreserveAlerts).toHaveBeenCalledWith(true);
expect(alertService.error).toHaveBeenCalledWith(ERROR.message);
expect(router.navigate).not.toHaveBeenCalledWith([`/cases/case-details/${CASE_ID}/tasks`]);
done();
});
expect(profileService.get).toHaveBeenCalledWith();
});


it('should return cached profile without making API call', () => {
casesService.getEventTrigger.and.returnValue(EVENT_TRIGGER_OBS);
eventTriggerResolver['cachedProfile'] = PROFILE_CACHED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ export class EventTriggerResolver implements Resolve<CaseEventTrigger> {
this.alertService.setPreserveAlerts(true);
this.alertService.error(error.message);
this.errorNotifier.announceError(error);
this.router.navigate([`/cases/case-details/${cid}/tasks`]);
// EXUI-2730 - Added logic to prevent navigation to tasks while on a case details page
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine for now, but i'm not sure how this will function once SRT is merged as the url will be different and include case_type and jurisdiction

// Unsure if actually necessary but left in place to mitigate risk
if (!this.router.url?.includes('/cases/case-details/')) {
this.router.navigate([`/cases/case-details/${cid}/tasks`]);
}
return throwError(error);
})
).toPromise();
Expand Down