From 9ab679566d57cbca8f29b18d8d884be53993ba48 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Thu, 30 Jul 2026 10:29:43 +0200 Subject: [PATCH] Don't check enterprise previews in `KonsistPreviewTest` (#7297) Don't check enterprise previews in `KonsistPreviewTest` --- .../android/tests/konsist/KonsistPreviewTest.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistPreviewTest.kt b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistPreviewTest.kt index deaa903e25..e2a387eede 100644 --- a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistPreviewTest.kt +++ b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistPreviewTest.kt @@ -11,6 +11,7 @@ package io.element.android.tests.konsist import androidx.compose.ui.tooling.preview.PreviewLightDark import com.google.common.truth.Truth.assertThat import com.lemonappdev.konsist.api.Konsist +import com.lemonappdev.konsist.api.declaration.KoFunctionDeclaration import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf import com.lemonappdev.konsist.api.ext.list.withName import com.lemonappdev.konsist.api.ext.list.withNameEndingWith @@ -61,6 +62,8 @@ class KonsistPreviewTest { .scopeFromProject() .functions() .withAllAnnotationsOf(PreviewsDayNight::class) + // We can't check Enterprise previews because they are in a different repo, and they aren't present for FOSS + .withoutEnterpriseFunctions() .assertTrue { it.text.contains("ElementPreview") || it.text.contains("ElementTimelineItemPreview") @@ -88,8 +91,6 @@ class KonsistPreviewTest { "BackgroundVerticalGradientPreview", "ColorAliasesPreview", "EmojiItemWithPopupPreview", - "EnterpriseExtraDeveloperOptionsRendererBottomSheetPreview", - "EnterpriseExtraDeveloperOptionsRendererListItemPreview", "FocusedEventPreview", "GradientFloatingActionButtonCircleShapePreview", "HeaderFooterPageScrollablePreview", @@ -189,7 +190,8 @@ class KonsistPreviewTest { @Test fun `previewNameExceptions only contains existing functions`() { - val names = previewNameExceptions.toMutableSet() + val names = previewNameExceptions + .toMutableSet() Konsist .scopeFromProject() .functions() @@ -210,6 +212,8 @@ class KonsistPreviewTest { .functions() .withAllAnnotationsOf(PreviewsDayNight::class) .withoutName(previewNameExceptions) + // We can't check Enterprise previews because they are in a different repo, and they aren't present for FOSS + .withoutEnterpriseFunctions() .assertTrue( additionalMessage = "Functions for Preview should be named like this: Preview. " + "Exception can be added to the test, for multiple Previews of the same view", @@ -237,3 +241,7 @@ class KonsistPreviewTest { ) } } + +private fun List.withoutEnterpriseFunctions() = filter { function -> + function.packagee?.hasNameStartingWith("io.element.android.enterprise") != true +}