Skip to content

Commit

Permalink
EVA-PIMP add update return combined checkers (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rattenkrieg committed Dec 11, 2023
1 parent 17b3b6b commit 585124b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/CI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import java.lang.Boolean.parseBoolean
object Ci {

private const val SNAPSHOT_BASE = "0.6.0"
private const val RELEASE_VERSION = "0.5.0"
private const val RELEASE_VERSION = "0.5.1"
private val githubSha = System.getenv("GITHUB_SHA") ?: "latest"

val publishRelease = System.getProperty("release", "true").let(::parseBoolean)
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/src/main/resources/detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ complexity:
excludeStringsWithLessThan5Characters: true
ignoreStringsRegex: '$^'
TooManyFunctions:
active: true
excludes: [ '**/testFixtures/**', '**Repository.kt', ]
active: false
thresholdInFiles: 30
thresholdInClasses: 15
thresholdInInterfaces: 15
Expand Down
24 changes: 24 additions & 0 deletions eva-uow/src/main/kotlin/com/razz/eva/uow/verify/UowSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ class UowSpec<R> internal constructor(
return verified
}

fun <M : Model<*, *>> addsAndReturns(verify: M.() -> Unit): M {
verifyResultAs(verify)
return verifyAdded(verify)
}

fun <M : Model<*, *>> EqualityVerifierAware.addsAndReturns(id: ModelId<*>, verify: M.() -> Unit): M {
verifyResultAs(verify)
val verified = verifyAdded(verify)
equalityVerifier.verify(verified.id(), id)
return verified
}

fun <M : Model<*, *>> updatesEq(expected: M) {
verifyUpdated<M> { actual ->
check(actual == expected) { "Got unexpected update of [$actual]" }
Expand All @@ -67,6 +79,18 @@ class UowSpec<R> internal constructor(
return verified
}

fun <M : Model<*, *>> updatesAnReturns(verify: M.() -> Unit): M {
verifyResultAs(verify)
return verifyUpdated(verify)
}

fun <M : Model<*, *>> EqualityVerifierAware.updatesAnReturns(id: ModelId<*>, verify: M.() -> Unit): M {
verifyResultAs(verify)
val verified = verifyUpdated(verify)
equalityVerifier.verify(verified.id(), id)
return verified
}

fun <E : ModelEvent<*>> emitsEq(expected: E) {
verifyEmitted<E> { actual ->
check(actual == expected) { "Got unexpected emit of [$actual]" }
Expand Down

0 comments on commit 585124b

Please sign in to comment.