Skip to content

Commit 1750906

Browse files
fix: error message on test store
1 parent 2867437 commit 1750906

File tree

1 file changed

+4
-4
lines changed
  • composable-architecture-test/src/main/kotlin/composablearchitecture/test

1 file changed

+4
-4
lines changed

composable-architecture-test/src/main/kotlin/composablearchitecture/test/TestStore.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,19 @@ private constructor(
112112

113113
when (step) {
114114
is Step.Send<LocalAction, LocalState, Environment> -> {
115-
require(receivedActions.isEmpty()) { "Must handle all actions" }
115+
require(receivedActions.isEmpty()) { "Must handle all actions. Unhandled actions:\n" + receivedActions.joinToString(separator = "\n") }
116116
runReducer(fromLocalAction.reverseGet(step.action))
117117
expectedState = step.block(expectedState)
118118
}
119119
is Step.Receive<LocalAction, LocalState, Environment> -> {
120-
require(receivedActions.isNotEmpty()) { "Expected to receive an action, but received none" }
120+
require(receivedActions.isNotEmpty()) { "Expected to receive" + receivedActions.joinToString(separator = "\n") + "but received none" }
121121
val receivedAction = receivedActions.removeFirst()
122122
require(step.action == receivedAction) { "Actual and expected actions do not match" }
123123
runReducer(fromLocalAction.reverseGet(step.action))
124124
expectedState = step.block(expectedState)
125125
}
126126
is Step.Environment<LocalAction, LocalState, Environment> -> {
127-
require(receivedActions.isEmpty()) { "Must handle all received actions before performing this work" }
127+
require(receivedActions.isEmpty()) { "Must handle all received actions before performing this work." + receivedActions.joinToString(separator = "\n") + "are not handled" }
128128
step.block(environment)
129129
}
130130
is Step.Do -> step.block()
@@ -139,6 +139,6 @@ private constructor(
139139
}
140140
}
141141

142-
require(receivedActions.isEmpty()) { "Must handle all actions" }
142+
require(receivedActions.isEmpty()) { "Must handle all actions. Unhandled actions:\n" + receivedActions.joinToString(separator = "\n") }
143143
}
144144
}

0 commit comments

Comments
 (0)