SchemaFixtureSuite constructor
SchemaFixtureSuite({
- required String name,
- JsonMap? schema,
- String? schemaPath,
- required List<
SchemaFixtureCase> accept, - required List<
SchemaFixtureCase> reject,
Implementation
SchemaFixtureSuite({
required this.name,
this.schema,
String? schemaPath,
required this.accept,
required this.reject,
}) : schemaPath = schemaPath ?? '$name.schema.json' {
if (schema == null && this.schemaPath == '$name.schema.json') {
throw ArgumentError.value(
schemaPath,
'schemaPath',
'A suite without its own schema must name the schema it validates.',
);
}
for (final (label, cases) in [('accept', accept), ('reject', reject)]) {
final names = <String>{};
for (final fixture in cases) {
if (!names.add(fixture.name)) {
throw ArgumentError('Duplicate $label fixture "${fixture.name}".');
}
}
}
}