rejectValidationWarning function

void rejectValidationWarning(
  1. dynamic warningMatcher
)

Verify that no validation warning(s) matching warningMatcher were logged.

Be sure to call startRecordingValidationWarnings before any code that might log errors:

group('emits a warning to the console', () {
  setUp(startRecordingValidationWarnings);

  tearDown(stopRecordingValidationWarnings);

  test('when <describe something that should trigger a warning>', () {
    // Do something that should trigger a warning

    verifyValidationWarning(/* some Matcher or String */);
  });

  test('unless <describe something that should NOT trigger a warning>', () {
    // Do something that should NOT trigger a warning

    rejectValidationWarning(/* some Matcher or String */);
  });
},
    // Be sure to not run these tests in JS browsers
    // like Chrome, Firefox, etc. since  the OverReact
    // ValidationUtil.warn() method will only produce a
    // console warning when compiled in "dev" mode.
    testOn: '!js'
);

Related: verifyValidationWarning, startRecordingValidationWarnings, stopRecordingValidationWarnings

Implementation

void rejectValidationWarning(dynamic warningMatcher) {
  expect(_validationWarnings, everyElement(isNot(warningMatcher)),
      reason: 'Expected no recorded warnings to match: $warningMatcher'
  );
}