-
Notifications
You must be signed in to change notification settings - Fork 301
Increase code coverage of compose module #5932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
andremion
merged 40 commits into
develop
from
AND-730-increase-code-coverage-of-compose-module
Sep 23, 2025
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
b4b63d1
Add Turbine library to compose module
andremion 4a4d34d
Add unit tests for ChannelHeaderViewModel
andremion e92ebfa
Add unit tests for ChannelAttachmentsViewModel
andremion 00cb434
Add unit tests for ChannelInfoMemberViewModel
andremion 2fc1816
Add unit tests for ChannelInfoViewModel
andremion 8a77f56
Add unit tests for ChannelAttachmentsViewModelFactory
andremion 7384208
Add unit tests for ChannelHeaderViewModelFactory
andremion 4d8c42e
Add unit tests for ChannelInfoViewModelFactory
andremion 8a0fe1f
Add unit tests for ChannelInfoMemberViewModelFactory
andremion c05cf46
Add unit tests for ChannelViewModelFactory
andremion eea27b8
Add unit tests and preview for GiphyAttachmentContent
andremion 8b2ee54
Add previews and unit tests for media attachment content
andremion 7cc75a6
Add unit tests for PinnedMessageListViewModel
andremion 0f50eb5
Add unit tests for MentionListViewModel
andremion b9c5f68
Add unit tests for MentionListViewModelFactory
andremion 153b7be
Add unit tests for MessagesViewModelFactory
andremion 0477caa
Add unit tests for ThreadsViewModelFactory and ThreadListViewModel
andremion cba1886
Add unit tests for MentionSuggestionList
andremion 6e87d90
Remove the fixed height modifier in `FileUploadItem`
andremion 008eee9
Add unit tests for CommandSuggestionList
andremion 9324a54
Integrate Kover for better code coverage reporting
andremion c4f79ad
Update snapshots
andremion c04676b
Increase code coverage of ChannelsScreen
andremion 4e15324
Add unit tests for PinnedMessagesScreen and update PinnedMessageListS…
andremion 48fc390
Add unit tests for MessageComposerScreen
andremion 65543ee
Add unit tests for ChatsScreen
andremion 8183c2d
Increase coverage of CopyToClipboardHandlerImpl
andremion 7e25281
Increase code coverage of ChannelsScreen
andremion a136196
Add unit tests for ChatsScreen
andremion 1aa360b
Add unit tests for MessagesScreen
andremion 463c31f
Deprecate AudioWaveVSeekbar component
andremion 3f4ef65
Add unit tests and preview for AudioWaveVSeekbar component
andremion d0ddf04
Add unit tests for MessageModerationDialog
andremion cd6c9b7
Add previews and snapshot tests for MessageComposerRecordingContent
andremion 850dea8
Rename SuggestionLazyList to MentionSuggestionLazyList for clarity
andremion ba5e984
Refactor PinnedMessageListState to use default values and update tests
andremion 300f434
Refactor view models to use property accessors for controller and state
andremion 01342b5
code review
andremion 54ae703
Log only failed tests
andremion 09e7d70
Remove MessageComposerCommandSuggestionListHeader component factory
andremion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,72 @@ | ||
if (!rootProject.ext.sonar.ignoreModules.contains(name)) { | ||
apply plugin: 'jacoco' | ||
if (!rootProject.ext.sonar.ignoreModules.contains(name) && file("src/test").exists()) { | ||
apply plugin: "org.jetbrains.kotlinx.kover" | ||
apply plugin: "org.sonarqube" | ||
|
||
def isCore = (name == 'stream-chat-android-core') | ||
def isCompose = (name == 'stream-chat-android-compose') | ||
def testTask = isCore ? "test" : isCompose ? "verifyPaparazziDebug" : "testDebugUnitTest" | ||
def jacocoResults = "${buildDir}/reports/jacoco/report.xml" | ||
|
||
if (hasProperty('android')) { | ||
android { | ||
buildTypes { | ||
debug { | ||
testCoverageEnabled = true | ||
enableUnitTestCoverage = true | ||
enableAndroidTestCoverage true | ||
afterEvaluate { | ||
def isAndroidModule = plugins.hasPlugin("com.android.library") || plugins.hasPlugin("com.android.application") | ||
def hasPaparazziPlugin = plugins.hasPlugin("app.cash.paparazzi") | ||
|
||
if (isAndroidModule) { | ||
android { | ||
buildTypes { | ||
debug { | ||
testCoverageEnabled = true | ||
enableUnitTestCoverage = true | ||
enableAndroidTestCoverage true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
afterEvaluate { | ||
tasks.withType(Test).configureEach { | ||
jacoco.includeNoLocationClasses = true | ||
jacoco.excludes = ['jdk.internal.*'] | ||
} | ||
def testTaskName = isAndroidModule | ||
? (hasPaparazziPlugin ? "verifyPaparazziDebug" : "testDebugUnitTest") | ||
: "test" | ||
|
||
tasks.register("testCoverage", JacocoReport) { | ||
dependsOn testTask | ||
tasks.register("testCoverage") { | ||
group = "verification" | ||
description = "Run module-specific tests and generate coverage reports" | ||
dependsOn(testTaskName) | ||
|
||
reports { | ||
xml.required.set(true) | ||
xml.outputLocation.set(file(jacocoResults)) | ||
if (isAndroidModule) { | ||
dependsOn "koverXmlReportDebug", "koverHtmlReportDebug" | ||
} else { | ||
dependsOn "koverXmlReport", "koverHtmlReport" | ||
} | ||
} | ||
|
||
executionData.setFrom(fileTree(dir: buildDir, includes: [ | ||
"outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec", | ||
"jacoco/test.exec" | ||
])) | ||
|
||
def sources = isCore ? sourceSets.main.java.srcDirs : android.sourceSets.main.java.srcDirs | ||
sourceDirectories.setFrom(files(sources)) | ||
classDirectories.setFrom(files([ | ||
fileTree( | ||
dir: "${buildDir}/tmp/kotlin-classes/debug", | ||
excludes: rootProject.ext.sonar.excludeFilter | ||
), | ||
fileTree( | ||
dir: "${buildDir}/classes/kotlin/main", | ||
excludes: rootProject.ext.sonar.excludeFilter | ||
) | ||
])) | ||
kover { | ||
reports { | ||
verify { | ||
warningInsteadOfFailure = true | ||
} | ||
filters { | ||
excludes { | ||
// Existing sonar excludes | ||
classes(rootProject.ext.sonar.excludeFilter as String[]) | ||
// Exclude Compose-generated singletons | ||
classes("*ComposableSingletons*") | ||
// Exclude Compose previews | ||
annotatedBy("androidx.compose.ui.tooling.preview.Preview") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
sonarqube { | ||
properties { | ||
property "sonar.junit.reportPaths", "${buildDir}/test-results/${testTask}" | ||
property "sonar.coverage.jacoco.xmlReportPaths", jacocoResults | ||
sonarqube { | ||
properties { | ||
def mainSources = [] | ||
if (file("src/main/java").exists()) mainSources += "src/main/java" | ||
if (file("src/main/kotlin").exists()) mainSources += "src/main/kotlin" | ||
|
||
property "sonar.sources", mainSources.join(",") | ||
|
||
def xmlReportPaths = isAndroidModule | ||
? "$buildDir/reports/kover/reportDebug.xml" | ||
: "$buildDir/reports/kover/report.xml" | ||
|
||
property "sonar.junit.reportPaths", "${buildDir}/test-results/${testTaskName}" | ||
property "sonar.coverage.jacoco.xmlReportPaths", xmlReportPaths | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.