From 0a37dd3fe8f603929185a6e989883a5b31126ded Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Tue, 6 Jan 2026 01:24:47 +0300 Subject: [PATCH] fix(tests): add delay for presence processing in chat session test for tests with Valgrind --- tests/functionaltests/test_chat_session.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/functionaltests/test_chat_session.c b/tests/functionaltests/test_chat_session.c index cea65f41..f9da6da8 100644 --- a/tests/functionaltests/test_chat_session.c +++ b/tests/functionaltests/test_chat_session.c @@ -144,12 +144,11 @@ resets_to_barejid_after_presence_received(void **state) "dnd" "" ); - // TODO: This assertion is currently disabled because the presence update - // may not reliably appear in the console output when a chat session is active. - // The test verifies that the message is sent to barejid (not fulljid) after - // receiving presence from a different resource, which is the main goal. - // See: PR #63 review discussion - // assert_true(prof_output_regex("Buddy1.*dnd")); + // Wait for presence to be processed before sending next message. + // The presence output may appear in console or chat window depending on focus, + // so we use a small delay to ensure the session is reset to barejid. + // Under Valgrind, processing is slower, so this delay is necessary. + g_usleep(500000); // 500ms prof_input("/msg buddy1@localhost Outgoing 2"); assert_true(stbbr_received(