2025-12-14 02:32:50 +00:00
|
|
|
import Foundation
|
|
|
|
|
import Testing
|
2026-01-30 03:15:10 +01:00
|
|
|
@testable import OpenClaw
|
2025-12-14 02:32:50 +00:00
|
|
|
|
|
|
|
|
@Suite struct KeychainStoreTests {
|
|
|
|
|
@Test func saveLoadUpdateDeleteRoundTrip() {
|
2026-01-27 14:46:27 -06:00
|
|
|
let service = "bot.molt.tests.\(UUID().uuidString)"
|
2025-12-14 02:32:50 +00:00
|
|
|
let account = "value"
|
|
|
|
|
|
|
|
|
|
#expect(KeychainStore.delete(service: service, account: account))
|
|
|
|
|
#expect(KeychainStore.loadString(service: service, account: account) == nil)
|
|
|
|
|
|
|
|
|
|
#expect(KeychainStore.saveString("first", service: service, account: account))
|
|
|
|
|
#expect(KeychainStore.loadString(service: service, account: account) == "first")
|
|
|
|
|
|
|
|
|
|
#expect(KeychainStore.saveString("second", service: service, account: account))
|
|
|
|
|
#expect(KeychainStore.loadString(service: service, account: account) == "second")
|
|
|
|
|
|
|
|
|
|
#expect(KeychainStore.delete(service: service, account: account))
|
|
|
|
|
#expect(KeychainStore.loadString(service: service, account: account) == nil)
|
|
|
|
|
}
|
|
|
|
|
}
|