Cotton code
28 lines · 1.1 KB · SwiftRaw
// The one piece of the AI settings page that outlived it: forgetting the// provider keys an old build left in this phone's Keychain. The page folded// into Passwords ("API keys") on 2026-09-14; the settings sheet runs the forget.//// Every fixture value is synthetic and is never asserted on.import CottonKitimport XCTest@testable import CottonUIfinal class ByokLegacyKeychainTests: XCTestCase {    func testAKeyAnOldBuildLeftInTheKeychainIsDeletedAndNothingElseIs() async {        let elsewhere = CodeHostingLegacyKeychain.slot(for: "example.test")        let store = InMemorySecretStore([            "cotton.byok.anthropic": #"{"kind":"anthropic","key":"SYNTHETIC-0000"}"#,            "cotton.byok.openai": #"{"kind":"openai","key":"SYNTHETIC-0000"}"#,            elsewhere: #"{"token":"synthetic"}"#,        ])        await ByokLegacyKeychain.forget(in: store)        XCTAssertEqual(store.occupied, [elsewhere], "the two provider slots go, and nothing else does")        // Idempotent: the settings sheet calls this on every visit.        await ByokLegacyKeychain.forget(in: store)        XCTAssertEqual(store.occupied, [elsewhere])    }}