Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ android {

dependencies {
// In project library / feature modules
implementation(project(":design_system"))
implementation(project(":core"))
implementation(project(":database"))
implementation(project(":password_manager"))
implementation(project(":autofill"))
implementation(projects.designSystem)
implementation(projects.core)
implementation(projects.database)
implementation(projects.passwordManager)
implementation(projects.autofill)

// Android Core
implementation(libs.appcompat)
Expand Down
2 changes: 1 addition & 1 deletion autofill/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ android {
}

dependencies {
implementation(project(":database"))
implementation(projects.database)

implementation(libs.androidx.core.ktx)
implementation(libs.appcompat)
Expand Down
7 changes: 7 additions & 0 deletions database/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ android {
consumerProguardFiles("consumer-rules.pro")
}

sourceSets {
getByName("androidTest") {
assets.directories += "$projectDir/schemas"
}
}

buildTypes {
getByName("release") {
isMinifyEnabled = false
Expand Down Expand Up @@ -64,6 +70,7 @@ dependencies {

androidTestImplementation(libs.bundles.unit.test)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.junit.ktx)
androidTestImplementation(libs.androidx.runner)
androidTestImplementation(libs.coroutines.test)
androidTestImplementation(libs.room.testing)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.jeeldobariya.passcodes.database.master.migration

import androidx.room.testing.MigrationTestHelper
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.google.common.truth.Truth.assertThat
import com.jeeldobariya.passcodes.database.master.MasterDatabase
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class MasterDatabaseMigration1To2Test {

private val TEST_DB = "migration-1-2-test"

@get:Rule
val helper = MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
MasterDatabase::class.java
)

@Test
fun migrate_basicData() {
helper.createDatabase(TEST_DB, 1).apply {
execSQL("""
INSERT INTO passwords (id, domain, username, password, notes)
VALUES (1, 'example.com', 'user', 'pass', 'note')
""")
close()
}

val migratedDb = helper.runMigrationsAndValidate(
TEST_DB, 2, true, MIGRATION_1_2
)

val cursor = migratedDb.query("SELECT * FROM passwords")
assertThat(cursor.count).isEqualTo(1)
cursor.close()
}

@Test
fun migrate_emptyNotes_becomesNull() {
helper.createDatabase(TEST_DB, 1).apply {
execSQL("""
INSERT INTO passwords (id, domain, username, password, notes)
VALUES (1, 'd', 'u', 'p', '')
""")
close()
}

val db = helper.runMigrationsAndValidate(TEST_DB, 2, true, MIGRATION_1_2)

val cursor = db.query("SELECT notes FROM passwords WHERE id = 1")
cursor.moveToFirst()

assertThat(cursor.isNull(0)).isTrue()

cursor.close()
}

@Test
fun migrate_urlGenerated() {
helper.createDatabase(TEST_DB, 1).apply {
execSQL("""
INSERT INTO passwords (id, domain, username, password, notes)
VALUES (1, 'google.com', 'u', 'p', 'n')
""")
close()
}

val db = helper.runMigrationsAndValidate(TEST_DB, 2, true, MIGRATION_1_2)

val cursor = db.query("SELECT url FROM passwords WHERE id = 1")
cursor.moveToFirst()

assertThat(cursor.getString(0))
.isEqualTo("https://local.google.com")

cursor.close()
}
}
11 changes: 6 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
# Library versions
coreKtx = "1.17.0"
coreKtx = "1.18.0"
material = "1.13.0"
nav3Core = "1.0.1"
lifecycleViewmodelNav3 = "2.10.0"
Expand All @@ -17,17 +17,17 @@ coroutines = "1.10.2"
lifecycle = "2.10.0"
koin = "4.1.1"
composeMultiplatform = "1.10.2"
composeBom = "2026.02.01"
compose-activity = "1.12.4"
composeBom = "2026.03.00"
compose-activity = "1.13.0"
compose-viewmodel = "2.10.0"
datastorePreferences = "1.2.0"
datastorePreferences = "1.2.1"
kotlinSerializationJson = "1.10.0"

# Plugin versions
agp = "9.1.0"
ksp = "2.3.6"
kotlin = "2.3.10"
oss-license-plugin = "0.10.10" # Also update in settings.gradle.kts
oss-license-plugin = "0.10.10" # Always update also in settings.gradle.kts



Expand Down Expand Up @@ -94,6 +94,7 @@ junit = { module = "junit:junit", version.ref = "junit" }
truth = { module = "com.google.truth:truth", version.ref = "truth" }
androidx-runner = { module = "androidx.test:runner", version.ref = "runner" }
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-junit" }
androidx-junit-ktx = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidx-junit" }



Expand Down
6 changes: 3 additions & 3 deletions password_manager/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ android {
}

dependencies {
implementation(project(":design_system"))
implementation(project(":core"))
implementation(project(":database"))
implementation(projects.designSystem)
implementation(projects.core)
implementation(projects.database)

// Android Core
implementation(libs.androidx.core.ktx)
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

// Defines all modules in your project
include(":app")
include(":design_system")
Expand Down
Loading