approvalTest method
Performs an approval test.
description
is the name of the test. It is appended to the description in Tester
.
textForReview
is the meta data text used in the approval test.
Implementation
Future<void> approvalTest({
String? description,
String? textForReview,
Options? options,
}) async {
final resultCompleter = Completer<void>();
final widgetsMetaCompleter = Completer<String>();
// If no text passed, then get the widget meta from the widget tree
if (textForReview == null) {
await widgetsString.then((value) {
widgetsMetaCompleter.complete(value);
});
} else {
widgetsMetaCompleter.complete(textForReview);
}
await widgetsMetaCompleter.future.then((value) {
resultCompleter
.complete(_globalApprovalTest(description, value, options));
});
return resultCompleter.future;
}