mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-22 10:42:10 +10:00
Consolidate and optimize test suite (80 -> 43 tests)
This commit is contained in:
@@ -97,81 +97,29 @@ void test_web_server_callback() {
|
||||
Serial.println("[TEST] Web server callback test completed successfully");
|
||||
}
|
||||
|
||||
void test_config_reset_callback() {
|
||||
Serial.println("[TEST] Testing config reset callback...");
|
||||
// Test callback registration - verify all callbacks can be registered without crash
|
||||
void test_callback_registration() {
|
||||
Serial.println("[TEST] Testing callback registration...");
|
||||
|
||||
reset_callback_flags();
|
||||
|
||||
WiFiManager wm;
|
||||
|
||||
// Register all callbacks - verify registration doesn't crash
|
||||
wm.setConfigResetCallback(config_reset_callback);
|
||||
|
||||
// Reset settings should trigger callback
|
||||
wm.resetSettings();
|
||||
|
||||
// Note: Callback may or may not fire on resetSettings() depending on implementation
|
||||
// Just verify it doesn't crash
|
||||
TEST_ASSERT_TRUE_MESSAGE(true, "setConfigResetCallback() executed without crash");
|
||||
|
||||
Serial.println("[TEST] Config reset callback test completed successfully");
|
||||
}
|
||||
|
||||
void test_save_config_callback_registration() {
|
||||
Serial.println("[TEST] Testing save config callback registration...");
|
||||
|
||||
reset_callback_flags();
|
||||
|
||||
WiFiManager wm;
|
||||
|
||||
// Register callback
|
||||
wm.setSaveConfigCallback(save_config_callback);
|
||||
wm.setPreSaveConfigCallback(pre_save_config_callback);
|
||||
|
||||
// Note: These callbacks fire when WiFi is saved via web portal
|
||||
// We can't easily test the actual firing without HTTP requests,
|
||||
// but we can verify registration doesn't crash
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(true, "Save config callbacks registered without crash");
|
||||
|
||||
Serial.println("[TEST] Save config callback registration test completed successfully");
|
||||
}
|
||||
|
||||
void test_save_params_callback_registration() {
|
||||
Serial.println("[TEST] Testing save params callback registration...");
|
||||
|
||||
reset_callback_flags();
|
||||
|
||||
WiFiManager wm;
|
||||
|
||||
// Register callbacks
|
||||
wm.setSaveParamsCallback(save_params_callback);
|
||||
wm.setPreSaveParamsCallback(pre_save_params_callback);
|
||||
|
||||
// Note: These callbacks fire when parameters are saved via web portal
|
||||
// We can't easily test the actual firing without HTTP requests,
|
||||
// but we can verify registration doesn't crash
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(true, "Save params callbacks registered without crash");
|
||||
|
||||
Serial.println("[TEST] Save params callback registration test completed successfully");
|
||||
}
|
||||
|
||||
void test_config_portal_timeout_callback_registration() {
|
||||
Serial.println("[TEST] Testing config portal timeout callback registration...");
|
||||
|
||||
reset_callback_flags();
|
||||
|
||||
WiFiManager wm;
|
||||
|
||||
// Register callback
|
||||
wm.setConfigPortalTimeoutCallback(config_portal_timeout_callback);
|
||||
|
||||
// Note: This callback fires when config portal times out
|
||||
// We can't easily test the actual firing without waiting for timeout,
|
||||
// but we can verify registration doesn't crash
|
||||
// Call resetSettings to verify callback registration doesn't interfere
|
||||
wm.resetSettings();
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(true, "Config portal timeout callback registered without crash");
|
||||
// Verify registration doesn't crash
|
||||
TEST_ASSERT_TRUE_MESSAGE(true, "All callbacks registered without crash");
|
||||
|
||||
Serial.println("[TEST] Config portal timeout callback registration test completed successfully");
|
||||
Serial.println("[TEST] Callback registration test completed successfully");
|
||||
}
|
||||
|
||||
void test_multiple_callbacks() {
|
||||
|
||||
Reference in New Issue
Block a user