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 +}