toJson method
Encodes this CockpitTestCase as a JSON object.
Implementation
@override
Map<String, Object?> toJson() => <String, Object?>{
'schemaVersion': schemaVersion,
'kind': kind,
'id': id,
if (name != null) 'name': name,
if (description != null) 'description': description,
if (tags.isNotEmpty) 'tags': tags.toList(growable: false),
'target': target.toJson(),
'defaults': defaults.toJson(),
if (variables.isNotEmpty)
'variables': <String, Object?>{
for (final entry in variables.entries) entry.key: entry.value.toJson(),
},
if (fragments.isNotEmpty)
'fragments': <String, Object?>{
for (final entry in fragments.entries)
entry.key: entry.value.map((step) => step.toJson()).toList(),
},
if (setup.isNotEmpty) 'setup': setup.map((step) => step.toJson()).toList(),
'steps': steps.map((step) => step.toJson()).toList(),
if (finallySteps.isNotEmpty)
'finally': finallySteps.map((step) => step.toJson()).toList(),
...extensions,
};