createJsonResponseTest method

String createJsonResponseTest(
  1. String pathTestPage,
  2. String featureName,
  3. String pageName,
  4. String apiName,
  5. String jsonResponse,
)

Implementation

String createJsonResponseTest(
  String pathTestPage,
  String featureName,
  String pageName,
  String apiName,
  String jsonResponse,
) {
  final path = join(pathTestPage, 'json');

  DirectoryHelper.createDir(path);
  String formattedJsonString = jsonResponse.toString();

  try {
    Map<String, dynamic> jsonObject = json.decode(jsonResponse);
    jsonObject = processJson(jsonObject);
    formattedJsonString = json.encode(jsonObject);
  } catch (_) {}

  join(path, '${apiName.snakeCase}_success.json').write(formattedJsonString);

  StatusHelper.generated(join(path, '${apiName.snakeCase}_success.json'));

  return formattedJsonString;
}