67 lines
2.2 KiB
Swift
67 lines
2.2 KiB
Swift
#if os(Linux)
|
|
import Foundation
|
|
import Testing
|
|
@testable import CodexBarCLI
|
|
@testable import CodexBarCore
|
|
|
|
struct CursorLinuxTests {
|
|
@Test
|
|
func `Cursor database path honors absolute XDG config home`() {
|
|
let path = CursorAppAuthStore.resolveDefaultDBPath(
|
|
home: "/home/test",
|
|
environment: ["XDG_CONFIG_HOME": "/custom/config"])
|
|
#expect(path == "/custom/config/Cursor/User/globalStorage/state.vscdb")
|
|
}
|
|
|
|
@Test
|
|
func `Cursor database path falls back to dot config`() {
|
|
let path = CursorAppAuthStore.resolveDefaultDBPath(
|
|
home: "/home/test",
|
|
environment: [:])
|
|
#expect(path == "/home/test/.config/Cursor/User/globalStorage/state.vscdb")
|
|
}
|
|
|
|
@Test
|
|
func `Cursor database path rejects relative XDG config home`() {
|
|
let path = CursorAppAuthStore.resolveDefaultDBPath(
|
|
home: "/home/test",
|
|
environment: ["XDG_CONFIG_HOME": "relative/config"])
|
|
#expect(path == "/home/test/.config/Cursor/User/globalStorage/state.vscdb")
|
|
}
|
|
|
|
@Test
|
|
func `Cursor automatic source does not require macOS web support`() {
|
|
#expect(!CodexBarCLI.sourceModeRequiresWebSupport(
|
|
.auto,
|
|
provider: .cursor,
|
|
settings: ProviderSettingsSnapshot.make(
|
|
cursor: .init(cookieSource: .auto, manualCookieHeader: nil))))
|
|
}
|
|
|
|
@Test
|
|
func `Cursor descriptor accepts explicit web source`() {
|
|
#expect(CursorProviderDescriptor.descriptor.fetchPlan.sourceModes.contains(.web))
|
|
}
|
|
|
|
@Test
|
|
func `Cursor manual cookie does not require macOS web support`() {
|
|
#expect(!CodexBarCLI.sourceModeRequiresWebSupport(
|
|
.web,
|
|
provider: .cursor,
|
|
settings: ProviderSettingsSnapshot.make(
|
|
cursor: .init(
|
|
cookieSource: .manual,
|
|
manualCookieHeader: "WorkosCursorSessionToken=test"))))
|
|
}
|
|
|
|
@Test
|
|
func `disabled Cursor web source still requires macOS web support`() {
|
|
#expect(CodexBarCLI.sourceModeRequiresWebSupport(
|
|
.web,
|
|
provider: .cursor,
|
|
settings: ProviderSettingsSnapshot.make(
|
|
cursor: .init(cookieSource: .off, manualCookieHeader: nil))))
|
|
}
|
|
}
|
|
#endif
|