test: remove redundant coverage and consolidate duplicated suites
An adversarial audit of the three test targets rejected most pruning candidates: 110 of 183 proposed findings either cited files that do not exist, mistook architectural guards for tautologies, or treated tests that drive distinct production branches as duplicates. Delete tests that pinned no behavior beyond a fixture literal, an initializer assignment, or an assertion that could not fail, and drop the unused pluralForms helper. Merge the remaining duplicates into parameterized tests so each branch keeps its own assertion and failure localization.
This commit is contained in:
1 parent
7d4a73decc
commit
45e84f28bb
10 files changed
+39
-150
No files matched your search
@@ -13,45 +13,39 @@ struct PortForwardingPresentationTests {
|
||||
#expect(!PortForwardingFieldPresentation.hostTitle(for: host).contains(host.displayAddress))
|
||||
}
|
||||
|
||||
@Test(arguments: [PortForwardingRule.Kind.local, .dynamic])
|
||||
func localAndDynamicForwardingUseTheLocalPortResource(_ kind: PortForwardingRule.Kind) {
|
||||
@Test(arguments: [
|
||||
(PortForwardingRule.Kind.local, "Local Port"),
|
||||
(.dynamic, "Local Port"),
|
||||
(.remote, "Remote Port"),
|
||||
])
|
||||
func portLabelNamesThePortThatKindForwards(
|
||||
_ kind: PortForwardingRule.Kind,
|
||||
_ resource: String
|
||||
) {
|
||||
#expect(
|
||||
PortForwardingFieldPresentation.portLabel(for: kind).key
|
||||
== LocalizedStringResource("Local Port").key)
|
||||
== LocalizedStringResource(stringLiteral: resource).key)
|
||||
}
|
||||
|
||||
@Test func remoteForwardingUsesTheRemotePortResource() {
|
||||
#expect(
|
||||
PortForwardingFieldPresentation.portLabel(for: .remote).key
|
||||
== LocalizedStringResource("Remote Port").key)
|
||||
}
|
||||
|
||||
@Test(arguments: [PortForwardingRule.Kind.local, .remote])
|
||||
func fixedDestinationsAreShownForLocalAndRemoteForwarding(_ kind: PortForwardingRule.Kind) {
|
||||
#expect(PortForwardingFieldPresentation.showsDestination(for: kind))
|
||||
|
||||
@Test(arguments: [PortForwardingRule.Kind.local, .remote, .dynamic])
|
||||
func destinationFieldsFollowTheForwardingKind(_ kind: PortForwardingRule.Kind) {
|
||||
let expected: [String]
|
||||
switch kind {
|
||||
case .local:
|
||||
#expect(PortForwardingFieldPresentation.showsDestination(for: kind))
|
||||
expected = [localDeviceName, "SSH Host", "Destination"]
|
||||
case .remote:
|
||||
#expect(PortForwardingFieldPresentation.showsDestination(for: kind))
|
||||
expected = ["SSH Host", localDeviceName, "Destination"]
|
||||
case .dynamic:
|
||||
Issue.record("Dynamic forwarding does not show a fixed destination.")
|
||||
return
|
||||
#expect(!PortForwardingFieldPresentation.showsDestination(for: kind))
|
||||
expected = ["SOCKS5", localDeviceName, "SSH Host", "Requested Destination"]
|
||||
}
|
||||
assertOrdered(
|
||||
expected,
|
||||
in: PortForwardingFieldPresentation.directionDescription(for: kind).key)
|
||||
}
|
||||
|
||||
@Test func dynamicForwardingOmitsFixedDestinationFields() {
|
||||
#expect(!PortForwardingFieldPresentation.showsDestination(for: .dynamic))
|
||||
assertOrdered(
|
||||
["SOCKS5", localDeviceName, "SSH Host", "Requested Destination"],
|
||||
in: PortForwardingFieldPresentation.directionDescription(for: .dynamic).key)
|
||||
}
|
||||
|
||||
private var localDeviceName: String {
|
||||
#if os(macOS)
|
||||
"This Mac"
|
||||
|
||||
@@ -43,20 +43,6 @@ struct MobileMetricsHostAccessTests {
|
||||
#expect(preferences.values.map(\.id) == [hosts[3].id])
|
||||
}
|
||||
|
||||
@Test func failedAccessUsesErrorIndicatorRatherThanAnIndefiniteSpinner() {
|
||||
let server = ServerMetric(selection: MetricsSelection(id: UUID()), name: "Host")
|
||||
server.hostAccessError = .entitlementVerificationFailed
|
||||
#expect(MetricsInstrumentBody(server: server, sleeping: false).connectionIndicator == .attention)
|
||||
server.hostAccessError = .verifyingEntitlement
|
||||
server.isConnecting = true
|
||||
#expect(MetricsInstrumentBody(server: server, sleeping: false).connectionIndicator == .progress)
|
||||
}
|
||||
|
||||
@Test func hostQuotaDoesNotProduceAFallbackSaveAlert() {
|
||||
let error: any Error = HostAccessError.hostLimit
|
||||
#expect(HostAccessError.presentationDescription(of: error) == nil)
|
||||
}
|
||||
|
||||
@Test func erasedHostAccessErrorsUseTheLocalizedPresentationMessage() {
|
||||
let error: any Error = HostAccessError.entitlementVerificationFailed
|
||||
#expect(error.localizedDescription == String(localized: AppStrings.Pro.accessVerificationFailed))
|
||||
|
||||
@@ -7,14 +7,6 @@ import Testing
|
||||
|
||||
@Suite @MainActor
|
||||
struct MobileNavigationParityTests {
|
||||
@Test func fiveDestinationsShareOneOrder() {
|
||||
let features = MobileFeatureRegistry.standard()
|
||||
#expect(
|
||||
features.registrations.map(\.id)
|
||||
== [.vault, .metrics, .workspaces, .assistant, .settings]
|
||||
)
|
||||
}
|
||||
|
||||
@Test func metricsUsesAvailableWidthRatherThanDeviceOrientation() {
|
||||
#expect(!MobileMetricsDetailPage.showsBothColumns(width: 430))
|
||||
#expect(!MobileMetricsDetailPage.showsBothColumns(width: 680))
|
||||
|
||||
@@ -194,11 +194,6 @@ struct AppLanguageTests {
|
||||
#expect(!DeviceCensorship.containsColoredPixel([]))
|
||||
}
|
||||
|
||||
private func pluralForms(in localization: [String: Any]) -> [String: Any] {
|
||||
let variations = localization["variations"] as? [String: Any]
|
||||
return variations?["plural"] as? [String: Any] ?? [:]
|
||||
}
|
||||
|
||||
private func makeDefaults() throws -> UserDefaults {
|
||||
let suiteName = "AppLanguageTests.\(UUID().uuidString)"
|
||||
let defaults = try #require(UserDefaults(suiteName: suiteName))
|
||||
|
||||
@@ -332,11 +332,6 @@ struct ChatComposerStateTests {
|
||||
))
|
||||
}
|
||||
|
||||
@Test
|
||||
func reasoningEffortDefaultsToMedium() {
|
||||
#expect(ConversationModel().reasoningEffort == .medium)
|
||||
}
|
||||
|
||||
@Test
|
||||
func reasoningEffortStaysScopedToItsConversation() {
|
||||
let first = ConversationModel()
|
||||
@@ -744,30 +739,6 @@ struct ChatComposerStateTests {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
func stoppingSettlesAnImmediatelyPresentedPartialAnswer() {
|
||||
let conversation = ConversationModel(
|
||||
contextEstimatePublishInterval: .seconds(60)
|
||||
)
|
||||
let runID = UUID()
|
||||
let assistant = AgentTranscriptMessage(role: .assistant)
|
||||
conversation.handle(
|
||||
.runStarted(
|
||||
AgentRunSummary(
|
||||
id: runID, state: .running, startedAt: .now
|
||||
)))
|
||||
conversation.handle(.runState(.running))
|
||||
conversation.handle(.messageStarted(assistant))
|
||||
conversation.handle(.messageDelta(messageID: assistant.id, text: "first"))
|
||||
conversation.handle(.messageDelta(messageID: assistant.id, text: " tail"))
|
||||
|
||||
conversation.stop()
|
||||
|
||||
let visible = conversation.messages.first { $0.id == assistant.id }
|
||||
#expect(visible?.text == "first tail")
|
||||
#expect(visible?.isStreaming == false)
|
||||
}
|
||||
|
||||
@Test
|
||||
func immediatelyCompletedRuntimeStillReachesTheConversation() async {
|
||||
let conversation = ConversationModel()
|
||||
|
||||
@@ -21,17 +21,6 @@ struct ChatSlashCommandTests {
|
||||
),
|
||||
]
|
||||
|
||||
@Test
|
||||
func commandsDeclareTheirSupportedPlatforms() {
|
||||
let archive = ChatSlashCommand(
|
||||
id: "archive", displayName: "Archive", summary: "Archive this chat",
|
||||
icon: .symbol("archivebox"), platforms: [.desktop]
|
||||
)
|
||||
|
||||
#expect(archive.platforms == [.desktop])
|
||||
#expect(commands.allSatisfy { $0.platforms == ChatSlashCommand.Platform.allCases })
|
||||
}
|
||||
|
||||
private func options(_ command: ChatSlashCommand) -> [ChatSlashCommand.Option] {
|
||||
guard command.id == "reasoning" else { return [] }
|
||||
return [
|
||||
|
||||
@@ -156,22 +156,6 @@ struct ConnectionJourneyTests {
|
||||
#expect(journey.localRequirement == nil)
|
||||
}
|
||||
|
||||
@Test
|
||||
func authenticationPromptDistinguishesIdentityCollectionFromServerChallenge() {
|
||||
let host = Host(name: "Server", host: "server.example")
|
||||
let localPrompt = SSHAuthenticationPrompt(
|
||||
host: host, username: "", selectedKeyID: nil,
|
||||
failureMessage: nil, mode: .localIdentity
|
||||
)
|
||||
let serverPrompt = SSHAuthenticationPrompt(
|
||||
host: host, username: "deploy", selectedKeyID: nil,
|
||||
failureMessage: "Authentication rejected", mode: .serverChallenge
|
||||
)
|
||||
|
||||
#expect(localPrompt.mode == .localIdentity)
|
||||
#expect(serverPrompt.mode == .serverChallenge)
|
||||
}
|
||||
|
||||
@Test
|
||||
func routeProgressIsMonotonicAcrossReconnectProbes() {
|
||||
let first = Host(name: "Jump", host: "jump.example")
|
||||
|
||||
@@ -30,14 +30,16 @@ struct MCPWebAuthenticationPresenterTests {
|
||||
#expect(throws: MCPWebAuthenticationError.sessionUnavailable) { try result.get() }
|
||||
}
|
||||
|
||||
@Test func backgroundFailureDoesNotExposeSystemErrorDetails() async {
|
||||
let result = await deliver(error: NSError(domain: "OAuth fixture", code: 99))
|
||||
#expect(throws: MCPWebAuthenticationError.sessionUnavailable) { try result.get() }
|
||||
}
|
||||
@Test func unavailableSessionsHideBothMissingCallbackAndBackgroundFailures() async {
|
||||
let missingCallback = await deliver()
|
||||
#expect(throws: MCPWebAuthenticationError.sessionUnavailable) {
|
||||
try missingCallback.get()
|
||||
}
|
||||
|
||||
@Test func missingCallbackReturnsSessionUnavailable() async {
|
||||
let result = await deliver()
|
||||
#expect(throws: MCPWebAuthenticationError.sessionUnavailable) { try result.get() }
|
||||
let backgroundFailure = await deliver(error: NSError(domain: "OAuth fixture", code: 99))
|
||||
#expect(throws: MCPWebAuthenticationError.sessionUnavailable) {
|
||||
try backgroundFailure.get()
|
||||
}
|
||||
}
|
||||
|
||||
private func deliver(callback: URL? = nil, error: (any Error)? = nil) async -> Result<URL, any Error> {
|
||||
|
||||
@@ -17,18 +17,6 @@ struct MarkdownParsingTests {
|
||||
#expect(paragraphText(blocks.last) == "second")
|
||||
}
|
||||
|
||||
@Test
|
||||
func newlineInsideAParagraphUsesUpstreamSoftBreaks() {
|
||||
let blocks = TermindMarkdownParser.parse("**Note:** this matters\nAnother line here")
|
||||
guard case .paragraph(let inlines)? = blocks.first else {
|
||||
Issue.record("expected a paragraph, got \(blocks)")
|
||||
return
|
||||
}
|
||||
#expect(inlines.contains(.softBreak))
|
||||
#expect(!inlines.contains(.lineBreak))
|
||||
#expect(inlineText(inlines).contains("matters Another"))
|
||||
}
|
||||
|
||||
@Test
|
||||
func tableCarriesItsColumnAlignments() {
|
||||
let blocks = TermindMarkdownParser.parse(
|
||||
@@ -230,11 +218,21 @@ struct MarkdownParsingTests {
|
||||
#expect(TermindMarkdownParser.parse("").isEmpty)
|
||||
}
|
||||
|
||||
@Test(arguments: ["first\\\nsecond", "first \nsecond"])
|
||||
func explicitHardBreaksRemainLineBreaks(source: String) {
|
||||
@Test(arguments: [
|
||||
"**Note:** this matters\nAnother line here",
|
||||
"first\\\nsecond",
|
||||
"first \nsecond",
|
||||
])
|
||||
func paragraphLineBreaksFollowUpstreamSoftAndHardRules(source: String) {
|
||||
let inlines = paragraphInlines(TermindMarkdownParser.parse(source).first)
|
||||
#expect(inlines.contains(.lineBreak))
|
||||
#expect(inlineText(inlines) == "first\nsecond")
|
||||
if source.hasPrefix("**Note:**") {
|
||||
#expect(inlines.contains(.softBreak))
|
||||
#expect(!inlines.contains(.lineBreak))
|
||||
#expect(inlineText(inlines).contains("matters Another"))
|
||||
} else {
|
||||
#expect(inlines.contains(.lineBreak))
|
||||
#expect(inlineText(inlines) == "first\nsecond")
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
|
||||
@@ -633,28 +633,6 @@ struct TranscriptListViewBridgeTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func userBubbleUsesASubtleAccentFillInLightAndDarkAppearances() throws {
|
||||
for appearanceName in [NSAppearance.Name.aqua, .darkAqua] {
|
||||
let coordinator = TranscriptListView.Coordinator()
|
||||
let listView = coordinator.makeListView()
|
||||
listView.appearance = NSAppearance(named: appearanceName)
|
||||
listView.frame = CGRect(x: 0, y: 0, width: 420, height: 800)
|
||||
let id = UUID()
|
||||
|
||||
update(coordinator, listView, entries: [user(id: id, text: "Hi")])
|
||||
listView.layoutSubtreeIfNeeded()
|
||||
|
||||
let row = try #require(listView.rowView(for: id))
|
||||
let bubble = try #require(
|
||||
descendant(in: row, identifier: "Transcript.UserBubble")
|
||||
)
|
||||
bubble.updateLayer()
|
||||
let color = try #require(bubble.layer?.backgroundColor.flatMap(NSColor.init(cgColor:)))
|
||||
#expect(abs(color.alphaComponent - 0.10) < 0.002)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func mountedTranscriptRefreshesWhenSystemAppearanceChanges() throws {
|
||||
let coordinator = TranscriptListView.Coordinator()
|
||||
|
||||
Reference in new issue
Block a user