Skip to content

Commit

Permalink
Add testFetchNonWorkflowConfigResourcesWithAllEntry test
Browse files Browse the repository at this point in the history
  • Loading branch information
qiarie committed Dec 20, 2024
1 parent 9e061ac commit c033e5f
Showing 1 changed file with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,27 @@ class ConfigurationRegistryTest : RobolectricTest() {
}

@Test
fun testPopulateConfigurationsMapWithNeitherFocusNorEntry() = runTest {
val composition = Composition().apply { section = listOf(SectionComponent()) }
fun testPopulateConfigurationsMapWithNeitherFocusNorEntry() = runBlocking {
val composition =
Composition().apply {
section =
listOf(
SectionComponent().apply {
focus =
Reference().apply {
reference = "Questionnaire/1"
identifier = Identifier().apply { value = "firstQuestionnaire" }
}
entry =
listOf(
Reference().apply {
reference = "Questionnaire/2"
identifier = Identifier().apply { value = "secondQuestionnaire" }
},
)
},
)
}

configRegistry.populateConfigurationsMap(context, composition, false, "app-id") {}

Expand Down Expand Up @@ -1129,4 +1148,30 @@ class ConfigurationRegistryTest : RobolectricTest() {

configRegistry.fetchNonWorkflowConfigResources()
}

@Test
fun testFetchNonWorkflowConfigResourcesWithAllEntry() = runTest {
val appId = "app-id"
val composition =
Composition().apply {
identifier = Identifier().apply { value = appId }
section =
listOf(
SectionComponent().apply {
entry =
listOf(
Reference().apply {
identifier = Identifier().apply { value = "focus-1" }
reference = "ResourceType/1"
},
)
},
)
}

coEvery { fhirResourceDataSource.getResource(any()) } returns
Bundle().apply { addEntry().resource = composition }

configRegistry.fetchNonWorkflowConfigResources()
}
}

0 comments on commit c033e5f

Please sign in to comment.