Skip to content

Commit 1714cc7

Browse files
authored
PI-2370 - remove filter logic, as this is done in the nDeliusGateway api (#462)
* PI-2370 - remove filter logic, as this is done in the nDeliusGateway api * PI-2370 - update unit tests
1 parent 3ebb371 commit 1714cc7

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/services/GetDynamicRisksForPersonService.kt

+2-10
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,8 @@ class GetDynamicRisksForPersonService(
1919

2020
if (deliusCrn != null) {
2121
val allNDeliusDynamicRisks = nDeliusGateway.getDynamicRisksForPerson(deliusCrn)
22-
val filteredNDeliusDynamicRisks =
23-
allNDeliusDynamicRisks.data.filter {
24-
it.code in
25-
listOf(
26-
"RCCO", "RCPR", "REG22", "RVLN", "ALT8", "STRG", "AVIS", "ALT1", "WEAP",
27-
"RHRH", "RLRH", "RMRH", "RVHR", "RCHD", "REG15", "REG16", "REG17",
28-
"ALT4", "AVS2", "ALT7", "ALSH",
29-
)
30-
}
31-
nDeliusDynamicRisks = Response(data = filteredNDeliusDynamicRisks, errors = allNDeliusDynamicRisks.errors)
22+
23+
nDeliusDynamicRisks = Response(data = allNDeliusDynamicRisks.data, errors = allNDeliusDynamicRisks.errors)
3224
}
3325

3426
return Response(

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/services/GetDynamicRisksForPersonServiceTest.kt

+3-16
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,11 @@ internal class GetDynamicRisksForPersonServiceTest(
114114
it("returns dynamic risks filtered data") {
115115
val response = getDynamicRisksForPersonService.execute(hmppsId)
116116

117-
response.data.shouldHaveSize(1)
117+
response.data.shouldHaveSize(2)
118118
response.data[0].code shouldBe "RCCO"
119119
response.data[0].description shouldBe "Child Concerns"
120-
}
121-
122-
it("returns an error when the dynamic risk code is not in the allowed list") {
123-
whenever(personService.execute(hmppsId = deliusCrn)).thenReturn(Response(person))
124-
whenever(personService.execute(hmppsId = hmppsId)).thenReturn(Response(person))
125-
whenever(nDeliusGateway.getDynamicRisksForPerson(deliusCrn)).thenReturn(
126-
Response(
127-
data = listOf(nonMatchingDynamicRisk),
128-
),
129-
)
130-
131-
val response = getDynamicRisksForPersonService.execute(hmppsId)
132-
133-
response.errors.shouldHaveSize(0)
134-
response.data.shouldHaveSize(0)
120+
response.data[1].code shouldBe "INVALID"
121+
response.data[1].description shouldBe "Invalid Dynamic Risk!"
135122
}
136123
},
137124
)

0 commit comments

Comments
 (0)