test: cover bridge status summary

off state, enabled state with a cell and nearby-only compose, and the
zero-bridged-peers case.
This commit is contained in:
Taksh 2026-08-09 13:16:49 +00:00
parent 0d4e37632e
commit 108818d6eb
No known key found for this signature in database

View File

@ -0,0 +1,28 @@
//
// BridgeStatusSummaryTests.swift
// bitchatTests
//
// This is free and unencumbered software released into the public domain.
// For more information, see <https://unlicense.org>
//
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"))
}
}