stopRecordingValidationWarnings function
void
stopRecordingValidationWarnings()
Stops recording the OverReact ValidationUtil.warn
ings that were being
recorded as a result of calling startRecordingValidationWarnings.
For use within tearDown
:
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: startRecordingValidationWarnings, verifyValidationWarning, rejectValidationWarning
Implementation
void stopRecordingValidationWarnings() {
_validationWarnings = null;
if (ValidationUtil.onWarning == _recordValidationWarning) {
ValidationUtil.onWarning = null;
}
}