43 lines
1.3 KiB
Swift
43 lines
1.3 KiB
Swift
import XCTest
|
|
@testable import CommandNotch
|
|
|
|
@MainActor
|
|
final class AppSettingsControllerTests: XCTestCase {
|
|
func testTerminalSessionConfigurationIncludesShellPath() {
|
|
let store = InMemoryAppSettingsStore()
|
|
var settings = AppSettings.default
|
|
settings.terminal.shellPath = "/opt/homebrew/bin/fish"
|
|
store.storedSettings = settings
|
|
|
|
let controller = AppSettingsController(store: store)
|
|
|
|
XCTAssertEqual(controller.terminalSessionConfiguration.shellPath, "/opt/homebrew/bin/fish")
|
|
}
|
|
|
|
func testTerminalSizePresetsDecodeFromTypedSettings() {
|
|
let store = InMemoryAppSettingsStore()
|
|
let presets = [
|
|
TerminalSizePreset(name: "Wide", width: 960, height: 420, hotkey: .cmdShiftDigit(4))
|
|
]
|
|
var settings = AppSettings.default
|
|
settings.terminal.sizePresetsJSON = TerminalSizePresetStore.encodePresets(presets)
|
|
store.storedSettings = settings
|
|
|
|
let controller = AppSettingsController(store: store)
|
|
|
|
XCTAssertEqual(controller.terminalSizePresets, presets)
|
|
}
|
|
}
|
|
|
|
private final class InMemoryAppSettingsStore: AppSettingsStoreType {
|
|
var storedSettings = AppSettings.default
|
|
|
|
func load() -> AppSettings {
|
|
storedSettings
|
|
}
|
|
|
|
func save(_ settings: AppSettings) {
|
|
storedSettings = settings
|
|
}
|
|
}
|