How do I assert that an Option contains something in zio-test?

425 views Asked by At

I tried

assert(anOption)(contains("x"))

But that only works for Iterables such as List or Seq.

2

There are 2 answers

3
derpy On BEST ANSWER
assert(anOption)(isSome(equalTo("x")))
1
Alan On

Could also be assert(anOption)(equalTo(Some("x"))) - just using equality. Or if you want to use contains: assert(isTrue(anOption.contains("x"))) using the contains operator on option