Is there any way to assert that an optional value is not Nil in compile time? #2040
Unanswered
jotacoroe2y
asked this question in
How to... ?
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
we usually have steps in our E2E tests where we want to assert on a list of objects with optional properties:
For example this is one of our steps, using the containAtLeastOneItemThat expectation:
Where
localizedAttributes
key is typed as optional:This works fine in runtime, but in compile time I'll have the following error:
What I'm expecting here is that
isPresent()
expectation resolves in compile time in order to treat the propertylocalizedAttributes
as a required one. Something similar that you could expect from an assertion function.But this doesn't happen.
Is there a more correct way to execute the proposed example in order to achieve the expected output?
Regards,
Beta Was this translation helpful? Give feedback.
All reactions