commons-app / apps-android-commons

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons
https://commons-app.github.io/
Apache License 2.0
1.03k stars 1.24k forks source link

`Unresolved reference: mockk` when running unit tests #5945

Open nicolas-raoul opened 1 day ago

nicolas-raoul commented 1 day ago
> Task :app:compileBetaDebugUnitTestKotlin FAILED
e: app/src/test/kotlin/fr/free/nrw/commons/actions/ThanksClientTest.kt:7:11 Unresolved reference: mockk
e: app/src/test/kotlin/fr/free/nrw/commons/actions/ThanksClientTest.kt:8:11 Unresolved reference: mockk
e: app/src/test/kotlin/fr/free/nrw/commons/actions/ThanksClientTest.kt:42:9 Unresolved reference: mockkObject
e: app/src/test/kotlin/fr/free/nrw/commons/actions/ThanksClientTest.kt:43:9 Unresolved reference: every
e: app/src/test/kotlin/fr/free/nrw/commons/description/DescriptionEditActivityUnitTest.kt:23:11 Unresolved reference: mockk
e: app/src/test/kotlin/fr/free/nrw/commons/description/DescriptionEditActivityUnitTest.kt:24:11 Unresolved reference: mockk
e: app/src/test/kotlin/fr/free/nrw/commons/description/DescriptionEditActivityUnitTest.kt:91:9 Unresolved reference: mockkObject
e: app/src/test/kotlin/fr/free/nrw/commons/description/DescriptionEditActivityUnitTest.kt:92:9 Unresolved reference: every
e: app/src/test/kotlin/fr/free/nrw/commons/settings/SettingsFragmentUnitTests.kt:22:54 Cannot import 'createLocale', functions and properties can be imported only from packages or objects
e: app/src/test/kotlin/fr/free/nrw/commons/settings/SettingsFragmentUnitTests.kt:286:30 Unresolved reference: createLocale
e: app/src/test/kotlin/fr/free/nrw/commons/settings/SettingsFragmentUnitTests.kt:295:30 Unresolved reference: createLocale
e: app/src/test/kotlin/fr/free/nrw/commons/settings/SettingsFragmentUnitTests.kt:304:30 Unresolved reference: createLocale
rohit9625 commented 23 hours ago

Adding this dependency testImplementation("io. mockk:mockk:1.13.5") fixed the problem but got another import issue from SettingsFragment. This is causing a build failure. I am looking into it.

rohit9625 commented 22 hours ago

Well, I fixed it. Please assign me so that I can create a PR :)