Files
helder/Tests/HelderCoreTests/Files/ContextActionsTests.swift
T

28 lines
976 B
Swift

import HelderCore
import Testing
@Suite struct TerminalContextMenuTests {
private func labels(_ target: ContextTarget) -> [String] {
ContextActions.entries(for: target).compactMap { entry in
guard case let .action(_, label) = entry else { return nil }
return label
}
}
@Test func copyAppearsOnlyWithASelection() {
#expect(labels(.terminal(.agent, hasSelection: true)) == ["Copy", "Paste"])
#expect(labels(.terminal(.shell, hasSelection: false)) == ["Paste"])
}
@Test func theActionsNameTheirPane() {
#expect(ContextActions.entries(for: .terminal(.shell, hasSelection: true)) == [
.action(.copyTerminalSelection(.shell), label: "Copy"),
.action(.pasteIntoTerminal(.shell), label: "Paste"),
])
}
@Test func theMenuHasNoHeader() {
#expect(ContextActions.header(for: .terminal(.agent, hasSelection: false), projectName: "app").isEmpty)
}
}