Skip to content

Commit

Permalink
Move to coverage to unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
seadowg committed May 27, 2024
1 parent 8f6602c commit 250aa91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,6 @@ class EntityFormTest {
.assertTextDoesNotExist("Roman Roy")
}

@Test
fun fillingEntityUpdateForm_withoutSelectingEntity_doesNothing() {
testDependencies.server.addForm(
"one-question-entity-update.xml",
listOf(EntityListItem("people.csv"))
)

rule.withMatchExactlyProject(testDependencies.server.url)
.setupEntities("people")

.startBlankForm("One Question Entity Update")
.swipeToNextQuestion("Name")
.swipeToEndScreen()
.clickFinalize()

.startBlankForm("One Question Entity Update")
.assertText("Roman Roy")
}

@Test
fun entityListSecondaryInstancesAreConsistentBetweenFollowUpForms() {
testDependencies.server.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ class LocalEntityUseCasesTest {
assertThat(entitiesRepository.getEntities("things").size, equalTo(0))
}

@Test
fun `updateLocalEntitiesFromForm does not save entity that doesn't have an ID`() {
val entity =
org.javarosa.entities.Entity(EntityAction.CREATE, "things", null, "1", 1, emptyList())
val formEntities = Entities(listOf(entity))
entitiesRepository.addList("things")

LocalEntityUseCases.updateLocalEntitiesFromForm(formEntities, entitiesRepository)
assertThat(entitiesRepository.getEntities("things").size, equalTo(0))
}

@Test
fun `updateLocalEntitiesFromServer overrides offline version if the online version is newer`() {
entitiesRepository.save(Entity("songs", "noah", "Noa", 1))
Expand Down

0 comments on commit 250aa91

Please sign in to comment.