Clear preferences before offline subtask tests

pull/996/head
Alex Baker 6 years ago
parent 23bffa51bb
commit 175964cc33

@ -39,6 +39,7 @@ class OfflineSubtaskTest : InjectingTestCase() {
@Before @Before
override fun setUp() { override fun setUp() {
super.setUp() super.setUp()
preferences.clear()
tasks.clear() tasks.clear()
adapter = TaskAdapter() adapter = TaskAdapter()
adapter.setDataSource(dataSource) adapter.setDataSource(dataSource)

@ -52,7 +52,7 @@ class GtasksMetadataServiceTest : InjectingTestCase() {
// --- helpers // --- helpers
private fun whenSearchForMetadata() { private fun whenSearchForMetadata() {
metadata = googleTaskDao.getByTaskId(task!!.id!!) metadata = googleTaskDao.getByTaskId(task!!.id)
} }
private fun taskWithMetadata(id: String?): Task { private fun taskWithMetadata(id: String?): Task {

@ -21,7 +21,7 @@ class TaskTest : InjectingTestCase() {
Freeze.freezeClock { Freeze.freezeClock {
val task = Task() val task = Task()
taskDao.createNew(task) taskDao.createNew(task)
assertEquals(DateTimeUtils.currentTimeMillis(), task.creationDate as Long) assertEquals(DateTimeUtils.currentTimeMillis(), task.creationDate)
} }
} }

@ -35,8 +35,8 @@ class DeletionDaoTests : InjectingTestCase() {
taskDao.createNew(task) taskDao.createNew(task)
deletionDao.markDeleted(listOf(task.id)) deletionDao.markDeleted(listOf(task.id))
task = taskDao.fetch(task.id)!! task = taskDao.fetch(task.id)!!
assertTrue(task.modificationDate!! > task.creationDate!!) assertTrue(task.modificationDate > task.creationDate)
assertTrue(task.modificationDate!! < DateTimeUtils.currentTimeMillis()) assertTrue(task.modificationDate < DateTimeUtils.currentTimeMillis())
} }
@Test @Test
@ -45,8 +45,8 @@ class DeletionDaoTests : InjectingTestCase() {
taskDao.createNew(task) taskDao.createNew(task)
deletionDao.markDeleted(listOf(task.id)) deletionDao.markDeleted(listOf(task.id))
task = taskDao.fetch(task.id)!! task = taskDao.fetch(task.id)!!
assertTrue(task.deletionDate!! > task.creationDate!!) assertTrue(task.deletionDate > task.creationDate)
assertTrue(task.deletionDate!! < DateTimeUtils.currentTimeMillis()) assertTrue(task.deletionDate < DateTimeUtils.currentTimeMillis())
} }
override fun inject(component: TestComponent) = component.inject(this) override fun inject(component: TestComponent) = component.inject(this)

@ -73,7 +73,7 @@ class TagDataDaoTest : InjectingTestCase() {
tagDataDao.createNew(tagTwo) tagDataDao.createNew(tagTwo)
tagDao.insert(newTag(with(TAGDATA, tagOne), with(TASK, taskOne))) tagDao.insert(newTag(with(TAGDATA, tagOne), with(TASK, taskOne)))
tagDao.insert(newTag(with(TAGDATA, tagTwo), with(TASK, taskTwo))) tagDao.insert(newTag(with(TAGDATA, tagTwo), with(TASK, taskTwo)))
assertEquals(listOf(tagOne), tagDataDao.getTagDataForTask(taskOne.id!!)) assertEquals(listOf(tagOne), tagDataDao.getTagDataForTask(taskOne.id))
} }
@Test @Test

@ -19,7 +19,7 @@ object TagMaker {
val tag = Tag() val tag = Tag()
val task = lookup.valueOf(TASK, null as Task?)!! val task = lookup.valueOf(TASK, null as Task?)!!
tag.task = task.id tag.task = task.id
tag.setTaskUid(task.uuid!!) tag.setTaskUid(task.uuid)
tag.tagUid = lookup.valueOf(TAGUID, null as String?) tag.tagUid = lookup.valueOf(TAGUID, null as String?)
val tagData = lookup.valueOf(TAGDATA, null as TagData?) val tagData = lookup.valueOf(TAGDATA, null as TagData?)
if (tagData != null) { if (tagData != null) {

Loading…
Cancel
Save