parseString static method

EnsembleTestCase parseString(
  1. String content, {
  2. String? sourcePath,
})

Implementation

static EnsembleTestCase parseString(String content, {String? sourcePath}) {
  final dynamic doc = loadYaml(content);
  if (doc is! YamlMap) {
    throw EnsembleTestFailure(
        'Invalid test file${sourcePath != null ? ' ($sourcePath)' : ''}: root must be a map');
  }

  if (doc.containsKey('tests')) {
    throw EnsembleTestFailure(
      'Each *.test.yaml file defines one test at the root — remove the "tests" '
      'wrapper and put id, startScreen, and steps at the top level.',
    );
  }

  return _parseTestCase(doc, sourcePath: sourcePath);
}