From 108818d6eb728590273785e353fff7c792bd663f Mon Sep 17 00:00:00 2001 From: Taksh Date: Sun, 9 Aug 2026 13:16:49 +0000 Subject: [PATCH] test: cover bridge status summary off state, enabled state with a cell and nearby-only compose, and the zero-bridged-peers case. --- .../Services/BridgeStatusSummaryTests.swift | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 bitchatTests/Services/BridgeStatusSummaryTests.swift diff --git a/bitchatTests/Services/BridgeStatusSummaryTests.swift b/bitchatTests/Services/BridgeStatusSummaryTests.swift new file mode 100644 index 00000000..bf9b92d2 --- /dev/null +++ b/bitchatTests/Services/BridgeStatusSummaryTests.swift @@ -0,0 +1,28 @@ +// +// BridgeStatusSummaryTests.swift +// bitchatTests +// +// This is free and unencumbered software released into the public domain. +// For more information, see +// + +import Testing +@testable import bitchat + +struct BridgeStatusSummaryTests { + @Test func offStateDoesNotMentionBridgePeople() { + let text = BridgeStatusSummary.formatted(enabled: false, cell: "u4pruy", bridgedCount: 3, nearbyOnly: false) + #expect(text.lowercased().contains("bridge off")) + } + + @Test func enabledStateIncludesCellAndCount() { + let text = BridgeStatusSummary.formatted(enabled: true, cell: "u4pruy", bridgedCount: 2, nearbyOnly: true) + #expect(text.contains("u4pruy")) + #expect(text.contains("nearby")) + } + + @Test func enabledWithZeroPeersMentionsBridgeCell() { + let text = BridgeStatusSummary.formatted(enabled: true, cell: "u4pruy", bridgedCount: 0, nearbyOnly: false) + #expect(text.localizedCaseInsensitiveContains("u4pruy") || text.localizedCaseInsensitiveContains("bridge")) + } +}