From 1473128e5aa743eed3320971ee5e485193dffb9a Mon Sep 17 00:00:00 2001 From: Maddipatla Chatan Date: Mon, 5 Oct 2026 18:03:19 +0530 Subject: [PATCH] Prevent test leakage by resetting MeshEchoSettings Added a defer statement to reset MeshEchoSettings after clearing the mesh timeline to prevent test leakage. --- .../ChatPublicConversationCoordinatorContextTests.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bitchatTests/ChatPublicConversationCoordinatorContextTests.swift b/bitchatTests/ChatPublicConversationCoordinatorContextTests.swift index 13424e0f..52e1106f 100644 --- a/bitchatTests/ChatPublicConversationCoordinatorContextTests.swift +++ b/bitchatTests/ChatPublicConversationCoordinatorContextTests.swift @@ -421,6 +421,9 @@ struct ChatPublicConversationCoordinatorContextTests { let context = MockChatPublicConversationContext() let coordinator = ChatPublicConversationCoordinator(context: context) context.activeChannel = .mesh + // Clearing the mesh timeline writes MeshEchoSettings.clearedThrough to + // UserDefaults.standard; don't leak that into other tests or the host app. + defer { MeshEchoSettings.reset() } coordinator.clearCurrentPublicTimeline() @@ -438,6 +441,7 @@ struct ChatPublicConversationCoordinatorContextTests { coordinator.clearCurrentPublicTimeline() + #expect(context.clearedConversations == [.geohash("u4pruy")]) #expect(context.archivePurgeCount == 0) }