Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Make unit tests work from CLI (#846)
Leendert de Borst343ced5b3845
diff --git a/.github/workflows/mobile-app-build.yml b/.github/workflows/mobile-app-build.ymlindex ca390c882..c652445f1 100644--- a/.github/workflows/mobile-app-build.yml+++ b/.github/workflows/mobile-app-build.yml@@ -85,6 +85,12 @@ jobs:--output-dir ./build \--platform android+ - name: Run tests+ run: npm run test++ - name: Run linting+ run: npm run lint+- name: Setup Javauses: actions/setup-java@v3with:@@ -97,15 +103,19 @@ jobs:- name: Run Android Unit Testsrun: |cd android- ./gradlew testDebugUnitTest --tests "net.aliasvault.app.nativevaultmanager.*"+ ./gradlew :app:testDebugUnitTest --tests "net.aliasvault.app.*"++ - name: Upload Android Test Reports+ if: always()+ uses: actions/upload-artifact@v4+ with:+ name: android-test-reports+ path: apps/mobile-app/android/app/build/reports/tests/testDebugUnitTest/+ retention-days: 7- name: Build Android Apprun: |cd android./gradlew assembleDebug- - name: Run tests- run: npm run test- - name: Run linting- run: npm run lintdiff --git a/apps/mobile-app/android/app/build.gradle b/apps/mobile-app/android/app/build.gradleindex 7f2987933..9b2428ce1 100644--- a/apps/mobile-app/android/app/build.gradle+++ b/apps/mobile-app/android/app/build.gradle@@ -135,6 +135,16 @@ android {// Focus only on app/src and exclude expo modulesdisable 'InvalidPackage'}+ testOptions {+ unitTests.all {+ useJUnitPlatform()+ testLogging {+ events "passed", "failed", "skipped"+ exceptionFormat "full"+ showStandardStreams true+ }+ }+ }}// Apply static values from `gradle.properties` to the `android.packagingOptions`@@ -176,6 +186,9 @@ dependencies {testImplementation 'androidx.test:rules:1.5.0'testImplementation 'androidx.test.ext:junit:1.1.5'testImplementation 'org.robolectric:robolectric:4.9'+ testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2'+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'+ testImplementation 'org.junit.vintage:junit-vintage-engine:5.9.2'def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";diff --git a/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.kt b/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.ktindex dcf8acba4..1d6b26e68 100644--- a/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.kt+++ b/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.kt@@ -17,13 +17,10 @@ import kotlin.test.assertTrue@RunWith(RobolectricTestRunner::class)@Config(sdk = [28], manifest = Config.NONE)class AutofillTest {- private lateinit var credentialMatcher: CredentialMatcherprivate lateinit var testCredentials: List<Credential>@Beforefun setup() {- credentialMatcher = CredentialMatcher()-// Create test credentialstestCredentials = listOf(createTestCredential(@@ -56,7 +53,7 @@ class AutofillTest {@Testfun testExactUrlMatch() {- val matches = credentialMatcher.filterCredentialsByAppInfo(+ val matches = CredentialMatcher.filterCredentialsByAppInfo(testCredentials,"www.coolblue.nl",)@@ -67,7 +64,7 @@ class AutofillTest {@Testfun testBaseUrlMatch() {- val matches = credentialMatcher.filterCredentialsByAppInfo(+ val matches = CredentialMatcher.filterCredentialsByAppInfo(testCredentials,"https://gmail.com/signin",)@@ -78,7 +75,7 @@ class AutofillTest {@Testfun testRootDomainMatch() {- val matches = credentialMatcher.filterCredentialsByAppInfo(+ val matches = CredentialMatcher.filterCredentialsByAppInfo(testCredentials,"https://mail.google.com",)@@ -89,7 +86,7 @@ class AutofillTest {@Testfun testDomainNamePartMatch() {- val matches = credentialMatcher.filterCredentialsByAppInfo(+ val matches = CredentialMatcher.filterCredentialsByAppInfo(testCredentials,"https://coolblue.be",)@@ -101,7 +98,7 @@ class AutofillTest {@Testfun testPackageNameMatch() {- val matches = credentialMatcher.filterCredentialsByAppInfo(+ val matches = CredentialMatcher.filterCredentialsByAppInfo(testCredentials,"com.coolblue.app",)@@ -113,7 +110,7 @@ class AutofillTest {@Testfun testNoMatches() {- val matches = credentialMatcher.filterCredentialsByAppInfo(+ val matches = CredentialMatcher.filterCredentialsByAppInfo(testCredentials,"https://nonexistent.com",)@@ -123,7 +120,7 @@ class AutofillTest {@Testfun testInvalidUrl() {- val matches = credentialMatcher.filterCredentialsByAppInfo(+ val matches = CredentialMatcher.filterCredentialsByAppInfo(testCredentials,"not a url",)diff --git a/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/VaultStoreTest.kt b/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/VaultStoreTest.ktindex e808dc6ac..846fb9b73 100644--- a/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/VaultStoreTest.kt+++ b/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/VaultStoreTest.kt@@ -117,7 +117,7 @@ class VaultStoreTest {// Then, try to re-load the database and ensure the __EFMigrationsHistory table still exists.// This asserts that the database commit results in a properly exported and encrypted database file.- vaultStore.clearVault()+ vaultStore.clearCache()vaultStore.storeEncryptionKey(testEncryptionKeyBase64)vaultStore.unlockVault()