Skip to content

Conversation

@npwork
Copy link

@npwork npwork commented Dec 31, 2021

Description (What)

It would be nice to have null as a positive value(as well as undefined) for toBeOptionalOf

Justification (Why)

There are cases when object received from server (dto) has null as a value. In this case toBeOptionalOf fails which not correct. It should treat null the same way as undefined

How Can This Be Tested?

@JamieMason
Copy link
Owner

Thanks a lot, on my mobile just now but what I would want to do is instead put this behaviour in a new matcher called toBeNilOf, and maybe also add a toBeNullable of. This is just so it doesn't surprise anyone - although null means "nothing" it is still the presence of a value (even if that value describes nothing) - whereas undefined is the absence of a value.

Really hope that makes sense 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants