Add build timestamp as build config field (#1567)

This commit is contained in:
Rafał Borcz 2021-10-09 18:37:27 +02:00 committed by GitHub
parent 4e69cfe23c
commit a240fd5d5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 31 deletions

View file

@ -16,7 +16,7 @@ abstract class AbstractMigrationTest {
val dbName = "migration-test"
val context: Context get() = ApplicationProvider.getApplicationContext<Context>()
val context: Context get() = ApplicationProvider.getApplicationContext()
@get:Rule
val helper: MigrationTestHelper = MigrationTestHelper(
@ -33,7 +33,7 @@ abstract class AbstractMigrationTest {
).addMigrations(
*AppDatabase.getMigrations(
SharedPrefProvider(PreferenceManager.getDefaultSharedPreferences(context)),
AppInfo(context)
AppInfo()
)
).build()
// close the database and release any stream resources when the test finishes

View file

@ -29,15 +29,15 @@ class Migration35Test : AbstractMigrationTest() {
close()
}
helper.runMigrationsAndValidate(dbName, 35, true, Migration35(AppInfo(context)))
helper.runMigrationsAndValidate(dbName, 35, true, Migration35(AppInfo()))
val db = getMigratedRoomDatabase()
val students = runBlocking { db.studentDao.loadAll() }
assertEquals(2, students.size)
assertTrue { students[0].avatarColor in AppInfo(context).defaultColorsForAvatar }
assertTrue { students[1].avatarColor in AppInfo(context).defaultColorsForAvatar }
assertTrue { students[0].avatarColor in AppInfo().defaultColorsForAvatar }
assertTrue { students[1].avatarColor in AppInfo().defaultColorsForAvatar }
}
private fun createStudent(db: SupportSQLiteDatabase, id: Long) {

View file

@ -37,7 +37,7 @@ class StudentTest {
studentDb = studentDb,
semesterDb = semesterDb,
sdk = mockSdk,
appInfo = AppInfo(mockk()),
appInfo = AppInfo(),
appDatabase = mockk()
)
}