diff --git a/FrameworkTests/PortForwardingPresentationTests.swift b/FrameworkTests/PortForwardingPresentationTests.swift index 06889854..c261d893 100644 --- a/FrameworkTests/PortForwardingPresentationTests.swift +++ b/FrameworkTests/PortForwardingPresentationTests.swift @@ -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" diff --git a/TFITests/MobileMetricsHostAccessTests.swift b/TFITests/MobileMetricsHostAccessTests.swift index e943e8ab..142f13f6 100644 --- a/TFITests/MobileMetricsHostAccessTests.swift +++ b/TFITests/MobileMetricsHostAccessTests.swift @@ -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)) diff --git a/TFITests/MobileNavigationParityTests.swift b/TFITests/MobileNavigationParityTests.swift index 313e9ed4..3d9e614e 100644 --- a/TFITests/MobileNavigationParityTests.swift +++ b/TFITests/MobileNavigationParityTests.swift @@ -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)) diff --git a/TFMTests/AppLanguageTests.swift b/TFMTests/AppLanguageTests.swift index 2487a2c3..cfcfdbf7 100644 --- a/TFMTests/AppLanguageTests.swift +++ b/TFMTests/AppLanguageTests.swift @@ -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)) diff --git a/TFMTests/ChatComposerStateTests.swift b/TFMTests/ChatComposerStateTests.swift index f525eab4..bdf562e8 100644 --- a/TFMTests/ChatComposerStateTests.swift +++ b/TFMTests/ChatComposerStateTests.swift @@ -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() diff --git a/TFMTests/ChatSlashCommandTests.swift b/TFMTests/ChatSlashCommandTests.swift index aa570a15..89427ee8 100644 --- a/TFMTests/ChatSlashCommandTests.swift +++ b/TFMTests/ChatSlashCommandTests.swift @@ -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 [ diff --git a/TFMTests/ConnectionJourneyTests.swift b/TFMTests/ConnectionJourneyTests.swift index 459e22e7..97bd1922 100644 --- a/TFMTests/ConnectionJourneyTests.swift +++ b/TFMTests/ConnectionJourneyTests.swift @@ -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") diff --git a/TFMTests/MCPWebAuthenticationPresenterTests.swift b/TFMTests/MCPWebAuthenticationPresenterTests.swift index 9b5894e1..793e54e7 100644 --- a/TFMTests/MCPWebAuthenticationPresenterTests.swift +++ b/TFMTests/MCPWebAuthenticationPresenterTests.swift @@ -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 { diff --git a/TFMTests/MarkdownParsingTests.swift b/TFMTests/MarkdownParsingTests.swift index a9004c8d..0f9d9c82 100644 --- a/TFMTests/MarkdownParsingTests.swift +++ b/TFMTests/MarkdownParsingTests.swift @@ -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 diff --git a/TFMTests/TranscriptListViewTests.swift b/TFMTests/TranscriptListViewTests.swift index b1bbf236..b7b9194b 100644 --- a/TFMTests/TranscriptListViewTests.swift +++ b/TFMTests/TranscriptListViewTests.swift @@ -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()