getByType

TestNode getByType(

  1. String type
)

Get a single node by type

Implementation

TestNode getByType(String type) {
  final results = findByType(type);
  if (results.isEmpty) {
    throw TestingException('No node found with type: $type');
  }
  if (results.length > 1) {
    throw TestingException('Multiple nodes found with type: $type');
  }
  return results.first;
}