diff --git a/collect_app/src/test/java/org/odk/collect/android/instancemanagement/InstancesDataServiceTest.kt b/collect_app/src/test/java/org/odk/collect/android/instancemanagement/InstancesDataServiceTest.kt index 3b1f8b0a130..7b3c4e9ba05 100644 --- a/collect_app/src/test/java/org/odk/collect/android/instancemanagement/InstancesDataServiceTest.kt +++ b/collect_app/src/test/java/org/odk/collect/android/instancemanagement/InstancesDataServiceTest.kt @@ -30,6 +30,7 @@ import org.odk.collect.projects.ProjectDependencyFactory import org.odk.collect.settings.keys.ProjectKeys import org.odk.collect.shared.locks.ThreadSafeBooleanChangeLock import org.odk.collect.shared.settings.InMemSettings +import java.io.File @RunWith(AndroidJUnit4::class) class InstancesDataServiceTest { @@ -129,5 +130,7 @@ class InstancesDataServiceTest { assertThat(remainingInstances.size, equalTo(2)) assertThat(remainingInstances.any { it.status == STATUS_COMPLETE }, equalTo(true)) assertThat(remainingInstances.any { it.status == STATUS_SUBMISSION_FAILED }, equalTo(true)) + assertThat(File(remainingInstances[0].instanceFilePath).parentFile?.exists(), equalTo(true)) + assertThat(File(remainingInstances[1].instanceFilePath).parentFile?.exists(), equalTo(true)) } } diff --git a/collect_app/src/test/java/org/odk/collect/android/projects/ProjectResetterTest.kt b/collect_app/src/test/java/org/odk/collect/android/projects/ProjectResetterTest.kt index aab73cb5390..32e6b10c76d 100644 --- a/collect_app/src/test/java/org/odk/collect/android/projects/ProjectResetterTest.kt +++ b/collect_app/src/test/java/org/odk/collect/android/projects/ProjectResetterTest.kt @@ -214,11 +214,13 @@ class ProjectResetterTest { fun `Reset instances clears instances for current project`() { saveTestInstanceFiles(currentProjectId) setupTestInstancesDatabase(currentProjectId) + val instancesRepository = instancesRepositoryProvider.create(currentProjectId) + val instance = instancesRepository.all[0] resetAppState(listOf(ProjectResetter.ResetAction.RESET_INSTANCES)) - assertEquals(0, instancesRepositoryProvider.create(currentProjectId).all.size) - assertFolderEmpty(storagePathProvider.getOdkDirPath(StorageSubdirectory.INSTANCES, currentProjectId)) + assertEquals(0, instancesRepository.all.size) + assertEquals(false, File(instance.instanceFilePath).parentFile.exists()) } @Test