throwsPropError_Combination function

Matcher throwsPropError_Combination(
  1. String propName,
  2. String prop2Name,
  3. [String message = '']
)

A matcher to verify that a PropError.combination is thrown with the provided propName, prop2Name, and optional message.

This matcher will not work on PropError.combinations found within UiComponent2.propTypes. When testing prop type validation - use logsPropCombinationError.

Note: The message is matched rather than the Error instance due to Dart's wrapping of all throw as a DomException

Implementation

Matcher throwsPropError_Combination(String propName, String prop2Name, [String message = '']) {
  return throwsA(anyOf(
      hasToStringValue('V8 Exception'), /* workaround for https://github.com/dart-lang/sdk/issues/26093 */
      hasToStringValue(contains('InvalidPropCombinationError: Prop $propName and prop $prop2Name are set to '
          'incompatible values. $message'.trim()
      ))
  ));
}