generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
ce7d034
commit 2544492
Showing
3 changed files
with
85 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import type Service from '@ministryofjustice/hmpps-connect-dps-components/dist/types/Service' | ||
import { stubFor } from './wiremock' | ||
import { CaseLoad } from '../../server/data/interfaces/caseLoad' | ||
|
||
export default { | ||
stubFeComponentsPing: () => | ||
stubFor({ | ||
request: { | ||
method: 'GET', | ||
urlPath: '/frontend-components/health/ping', | ||
}, | ||
response: { | ||
status: 200, | ||
}, | ||
}), | ||
|
||
stubFeComponents: ( | ||
options: { | ||
caseLoads?: CaseLoad[] | ||
services?: Service[] | ||
residentialLocationsActive?: boolean | ||
} = {}, | ||
) => { | ||
const caseLoads = options.caseLoads || [ | ||
{ | ||
caseLoadId: 'LEI', | ||
currentlyActive: true, | ||
description: 'Leeds (HMP)', | ||
type: '', | ||
caseloadFunction: '', | ||
}, | ||
] | ||
|
||
return stubFor({ | ||
request: { | ||
method: 'GET', | ||
urlPattern: '/frontend-components/components\\?.*', | ||
}, | ||
response: { | ||
status: 200, | ||
headers: { | ||
'Content-Type': 'application/json;charset=UTF-8', | ||
}, | ||
jsonBody: { | ||
header: { html: '', css: [], javascript: [] }, | ||
footer: { html: '', css: [], javascript: [] }, | ||
meta: { | ||
caseLoads, | ||
activeCaseLoad: caseLoads.find(caseLoad => caseLoad.currentlyActive === true), | ||
services: options.services || [ | ||
{ | ||
id: 'check-my-diary', | ||
heading: 'Check my diary', | ||
description: 'View your prison staff detail (staff rota) from home.', | ||
href: 'http://localhost:3001', | ||
navEnabled: true, | ||
}, | ||
{ | ||
id: 'key-worker-allocations', | ||
heading: 'My key worker allocation', | ||
description: 'View your key worker cases.', | ||
href: 'http://localhost:3001/key-worker/111111', | ||
navEnabled: true, | ||
}, | ||
{ | ||
id: 'residential-locations', | ||
heading: 'Residential Locations', | ||
description: 'Manage residential locations.', | ||
href: 'http://localhost:3001/locations', | ||
navEnabled: options.residentialLocationsActive, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}) | ||
}, | ||
} |