Because of how async expectations are implemented, the Expression (await asyncFunctionPostingNotification() } is called before the matcher (postNotification(...)) is called. This is a result of the approach we take with async expressions, where the expression is evaluated, then the result of the expression is passed into the matcher.
Perhaps we should take this as a chance to rethink how AsyncExpectation works, and provide full end-to-end support for async expressions. We could use something approaching the current method as a fallback for existing, non-async matchers.
The following test does not work:
Because of how async expectations are implemented, the Expression (
await asyncFunctionPostingNotification() }
is called before the matcher (postNotification(...)
) is called. This is a result of the approach we take with async expressions, where the expression is evaluated, then the result of the expression is passed into the matcher.Perhaps we should take this as a chance to rethink how
AsyncExpectation
works, and provide full end-to-end support for async expressions. We could use something approaching the current method as a fallback for existing, non-async matchers.