Fix database test

This commit is contained in:
Koitharu
2022-07-18 11:34:00 +03:00
parent f0ee64bafa
commit aa5fd530d3
2 changed files with 9 additions and 7 deletions

View File

@@ -3,11 +3,12 @@ package org.koitharu.kotatsu.core.db
import androidx.room.testing.MigrationTestHelper
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import java.io.IOException
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.koitharu.kotatsu.core.db.migrations.*
import java.io.IOException
import kotlin.test.assertEquals
@RunWith(AndroidJUnit4::class)
class MangaDatabaseTest {
@@ -21,17 +22,15 @@ class MangaDatabaseTest {
@Test
@Throws(IOException::class)
fun migrateAll() {
helper.createDatabase(TEST_DB, 1).apply {
// TODO execSQL("")
close()
}
assertEquals(DATABASE_VERSION, migrations.last().endVersion)
helper.createDatabase(TEST_DB, 1).close()
for (migration in migrations) {
helper.runMigrationsAndValidate(
TEST_DB,
migration.endVersion,
true,
migration
)
).close()
}
}
@@ -50,6 +49,7 @@ class MangaDatabaseTest {
Migration8To9(),
Migration9To10(),
Migration10To11(),
Migration11To12(),
)
}
}