From 6c7ccdec8db626c4bcbd470cb7ede6b76b329659 Mon Sep 17 00:00:00 2001 From: takahirom Date: Sun, 7 Jul 2024 13:16:28 +0900 Subject: [PATCH] Use it instead of 'check' to follow the naming convention --- .../RobolectricDescribeSpecParameterBuilder.kt | 16 ++++++++-------- .../sessions/TimetableItemDetailScreenTest.kt | 16 ++++++++-------- .../confsched/sessions/TimetableScreenTest.kt | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobolectricDescribeSpecParameterBuilder.kt b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobolectricDescribeSpecParameterBuilder.kt index ce45cc71f..36152a414 100644 --- a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobolectricDescribeSpecParameterBuilder.kt +++ b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobolectricDescribeSpecParameterBuilder.kt @@ -12,7 +12,7 @@ suspend fun DescribedTestCase.execute(robot: T) { println("Executing step: $index ($description)") when (step) { is TestNode.Run -> step.action(robot) - is TestNode.Check -> { + is TestNode.It -> { if (step.description == targetCheckDescription) { step.action(robot) } @@ -27,7 +27,7 @@ suspend fun DescribedTestCase.execute(robot: T) { sealed class TestNode { data class Describe(val description: String, val children: List>) : TestNode() data class Run(val action: suspend T.() -> Unit) : TestNode() - data class Check(val description: String, val action: suspend T.() -> Unit) : TestNode() + data class It(val description: String, val action: suspend T.() -> Unit) : TestNode() } data class DescribedTestCase( @@ -46,7 +46,7 @@ data class AncestryNode( data class CheckNode( val description: String, val fullDescription: String, - val node: TestNode.Check, + val node: TestNode.It, val ancestry: List>, ) @@ -63,8 +63,8 @@ class TestCaseTreeBuilder { children.add(TestNode.Run { action() }) } - fun check(description: String, action: suspend T.() -> Unit) { - children.add(TestNode.Check(description) { action() }) + fun it(description: String, action: suspend T.() -> Unit) { + children.add(TestNode.It(description) { action() }) } fun build(): TestNode.Describe = TestNode.Describe("", children) @@ -93,9 +93,9 @@ private fun collectCheckNodes(root: TestNode.Describe): List } } - is TestNode.Check -> { + is TestNode.It -> { val fullDescription = if (parentDescription.isNotBlank()) { - "$parentDescription - ${node.description}" + "$parentDescription - it ${node.description}" } else { node.description } @@ -136,7 +136,7 @@ private fun createTestCase(checkNode: CheckNode): DescribedTestCase { steps.add(node) } - is TestNode.Check -> { + is TestNode.It -> { if (node == checkNode.node) { steps.add(node) } diff --git a/feature/sessions/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreenTest.kt b/feature/sessions/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreenTest.kt index adb25c285..37dea477e 100644 --- a/feature/sessions/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreenTest.kt +++ b/feature/sessions/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreenTest.kt @@ -54,18 +54,18 @@ class TimetableItemDetailScreenTest(private val testCase: DescribedTestCase