@@ -117,7 +117,6 @@ import org.smartregister.fhircore.engine.util.DispatcherProvider
117
117
import org.smartregister.fhircore.engine.util.SharedPreferencesHelper
118
118
import org.smartregister.fhircore.engine.util.extension.REFERENCE
119
119
import org.smartregister.fhircore.engine.util.extension.SDF_YYYY_MM_DD
120
- import org.smartregister.fhircore.engine.util.extension.appIdExistsAndIsNotNull
121
120
import org.smartregister.fhircore.engine.util.extension.asReference
122
121
import org.smartregister.fhircore.engine.util.extension.decodeResourceFromString
123
122
import org.smartregister.fhircore.engine.util.extension.encodeResourceToString
@@ -2163,15 +2162,30 @@ class FhirCarePlanGeneratorTest : RobolectricTest() {
2163
2162
2164
2163
@Test
2165
2164
fun testRetrievePlanDefinitionFromConfigMap () = runTest {
2166
- val sharedPreferencesHelper = mockk<SharedPreferencesHelper >()
2167
- val planDefinitionId = PlanDefinition ().apply { id = " plan-1" }
2165
+ val planDefinitionId = " myPlanDefId"
2168
2166
2169
- coEvery { appIdExistsAndIsNotNull(sharedPreferencesHelper) } returns true
2167
+ configurationRegistry.configsJsonMap[planDefinitionId] =
2168
+ " {\" resourceType\" : \" PlanDefinition\" , \" id\" : \" $planDefinitionId \" }"
2170
2169
2171
- configurationRegistry.configsJsonMap[planDefinitionId.id] = " PlanDefinition"
2172
2170
val planDefinition =
2173
- configurationRegistry.retrieveResourceFromConfigMap<PlanDefinition >(" PlanDef" )
2174
- planDefinition?.let { assertEquals(" PlanDefinition" , planDefinition.id) }
2171
+ configurationRegistry.retrieveResourceFromConfigMap<PlanDefinition >(planDefinitionId)
2172
+ val planDefIdOnly = planDefinition?.id?.substringAfterLast(' /' )
2173
+
2174
+ planDefinition?.let { assertEquals(planDefinitionId, planDefIdOnly) }
2175
+ }
2176
+
2177
+ @Test
2178
+ fun testRetrieveStructureMapFromConfigMap () = runTest {
2179
+ val structureMapId = " myStructureMapId"
2180
+
2181
+ configurationRegistry.configsJsonMap[structureMapId] =
2182
+ " {\" resourceType\" : \" StructureMap\" , \" id\" : \" $structureMapId \" }"
2183
+
2184
+ val structureMap =
2185
+ configurationRegistry.retrieveResourceFromConfigMap<StructureMap >(structureMapId)
2186
+ val structureMapIdOnly = structureMap?.id?.substringAfterLast(' /' )
2187
+
2188
+ structureMap?.let { assertEquals(structureMapId, structureMapIdOnly) }
2175
2189
}
2176
2190
2177
2191
@Test
0 commit comments