saveForClass method
Future<void>
saveForClass({
- required ClassElement classElement,
- required ElementAnnotation annotation,
- required CompilationUnit compilationUnit,
- required ClassDeclaration classAstNode,
- required PubspecData pubspecData,
- required File classFile,
- required TestRunInfo testRunInfo,
Implementation
Future<void> saveForClass(
{required ClassElement classElement,
required ElementAnnotation annotation,
required CompilationUnit compilationUnit,
required ClassDeclaration classAstNode,
required PubspecData pubspecData,
required File classFile,
required TestRunInfo testRunInfo}) async {
final List<String> excludedMethods = annotation.excludeMethods;
final fileImport =
'package:${pubspecData.packageName}/${PathUtils.relatetiveLibFilePath(classFile.path)}';
final methodAstNodes = await classElement.getMethodDeclarations;
List<Future> saveFutures = [];
for (int i = 0; i < methodAstNodes.entries.length; i++) {
final method = methodAstNodes.entries.elementAt(i);
saveFutures.add(_saveTestsForMethod(
method: method,
compilationUnit: compilationUnit,
classAstNode: classAstNode,
fileImport: fileImport,
excludedMethods: excludedMethods,
subjectFile: classFile,
testRunInfo: testRunInfo,
className: classElement.displayName,
methodAstNodes: methodAstNodes));
}
await Future.wait(saveFutures);
}