sloydev
11/26/2020, 10:41 AMexpectThat(output) {
should("Replace anonymous id") {
get { anonymousId() }.isEqualTo("anonymous_user")
get { context().traits().anonymousId() }.isEqualTo("anonymous_user")
}
should("Remove advertisingId and deviceId") {
get { advertisingId() }.isNull()
get { deviceId() }.isNull()
}
}
So I get error messages like these:
✗ Replace anonymous id
▼ "5c6b6c02-4dd2d":
✗ is equal to "anonymous_user"
found "5c6b6c02-4dd2d"
▼ "5c6b6c02-4dd2d":
✗ is equal to "anonymous_user"
found "5c6b6c02-4dd2d"
✗ Remove advertisingId and deviceId
▼ "32c85c4d-c39b897c":
✗ is null
▼ "c55911907ad":
✗ is null
should
looks like this:
private fun <T> Assertion.Builder<T>.should(
description: String,
assertions: Assertion.Builder<T>.() -> Unit
) {
compose(description) {
assertions()
} then {
if (allPassed) pass() else fail()
}
}
robfletcher
11/26/2020, 2:54 PMand
function but with a descriptionsloydev
11/26/2020, 3:03 PMrobfletcher
11/26/2020, 4:57 PMAssertion.Builder
rather than being an extension.sloydev
11/27/2020, 8:19 AMshould
because it's the first thing that came to mind and fitted our test case, but super subjective. Is it ok? Or can you think of a more strikt-ish name? An existing name like and
or describedAs
? A new name like should
or group
or something else?robfletcher
11/27/2020, 2:18 PM