generateTest method

Future<void> generateTest({
  1. required String testTemplateSubPath,
  2. required String testDir,
  3. required Map<String, String> variables,
})

Generates a test file from a test template under templates/tests/.

testTemplateSubPath is the subdirectory under templates/tests/ (e.g. model). testDir is the target directory under test/. variables must include all placeholders needed by the test template (typically project_name, feature_name, class_name, and the entity-specific name like model_name).

Implementation

Future<void> generateTest({
  required String testTemplateSubPath,
  required String testDir,
  required Map<String, String> variables,
}) async {
  ensureDirectory(testDir);
  await copyTemplate(
    templateSubPath: testTemplateSubPath,
    targetDir: testDir,
    variables: variables,
    category: 'tests',
  );
}