add Unity unit tests

This commit is contained in:
proddy
2024-08-03 13:22:24 +02:00
parent 8f91394c75
commit 5050d11555
6 changed files with 688 additions and 200 deletions

View File

@@ -1541,9 +1541,16 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
}
// API Status
node = output["api"].to<JsonObject>();
node = output["api"].to<JsonObject>();
// if we're generating test data for Unit Tests we dont want to count these API calls as it will pollute the data response
#if defined(UNITY_INCLUDE_CONFIG_H)
node["APICalls"] = 0;
node["APIFails"] = 0;
#else
node["APICalls"] = WebAPIService::api_count();
node["APIFails"] = WebAPIService::api_fails();
#endif
// EMS Bus Status
node = output["bus"].to<JsonObject>();
@@ -1611,8 +1618,12 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
node["analogEnabled"] = settings.analog_enabled;
node["telnetEnabled"] = settings.telnet_enabled;
node["maxWebLogBuffer"] = settings.weblog_buffer;
node["webLogBuffer"] = EMSESP::webLogService.num_log_messages();
node["modbusEnabled"] = settings.modbus_enabled;
#if defined(UNITY_INCLUDE_CONFIG_H)
node["webLogBuffer"] = 0;
#else
node["webLogBuffer"] = EMSESP::webLogService.num_log_messages();
#endif
node["modbusEnabled"] = settings.modbus_enabled;
});
// Devices - show EMS devices if we have any