Skip to content

Instantly share code, notes, and snippets.

@supermanue
Created March 26, 2022 17:33
Show Gist options
  • Save supermanue/74d13beb72f62b80942e19c2dd6dc6ca to your computer and use it in GitHub Desktop.
Save supermanue/74d13beb72f62b80942e19c2dd6dc6ca to your computer and use it in GitHub Desktop.
Fixture testing
object FixturesTest extends DefaultRunnableSpec with DomainFixtures {
def spec: ZSpec[TestEnvironment, Failure] =
suite("Fixtures test")(
testM("positiveIntGen generates positive ints") {
check(positiveIntGen) { positiveInt =>
assert(positiveInt > 0)(isTrue)
}
},
testM("nonemptyStringGen generates nonempty strings") {
check(nonemptyStringGen) { nonemptyString =>
assert(nonemptyString.nonEmpty)(isTrue)
}
},
testM("userGen builds valid users") {
check(userGen) { user =>
assert(Try(user))(isSuccess)
}
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment