fromJson static method

CockpitTestSuiteCaseSource fromJson(
  1. Object? value, {
  2. required String path,
})

Implementation

static CockpitTestSuiteCaseSource fromJson(
  Object? value, {
  required String path,
}) {
  final json = CockpitTestValueReader.object(value, path);
  final kind = CockpitTestValueReader.string(json['kind'], '$path.kind');
  return switch (kind) {
    'inline' => CockpitTestSuiteInlineCaseSource.fromJson(value, path: path),
    'file' => CockpitTestSuiteFileCaseSource.fromJson(value, path: path),
    _ => throw FormatException(
      'Unsupported suite case source at $path.kind.',
    ),
  };
}