Allow preview function name to end with RtlPreview

This commit is contained in:
Benoit Marty
2025-08-18 17:03:54 +02:00
committed by Benoit Marty
parent 91369e9455
commit c0fe9f2616

View File

@@ -166,10 +166,15 @@ class KonsistPreviewTest {
additionalMessage = "Functions for Preview should be named like this: <ViewUnderPreview>Preview. " +
"Exception can be added to the test, for multiple Previews of the same view",
) {
val testedView = it.name.removeSuffix("Preview")
it.text.contains("$testedView(") ||
it.text.contains("$testedView {") ||
it.text.contains("ContentToPreview(")
val testedView = if (it.name.endsWith("RtlPreview")) {
it.name.removeSuffix("RtlPreview")
} else {
it.name.removeSuffix("Preview")
}
it.name.endsWith("Preview") &&
(it.text.contains("$testedView(") ||
it.text.contains("$testedView {") ||
it.text.contains("ContentToPreview("))
}
}