Cotton code
24 lines · 1.2 KB · SwiftRaw
import CottonKitimport CottonVoiceimport XCTest@testable import CottonUI/// RULE (launch-ios walk, 22 Nov 2026): a mic whose permission was refused is never a dead button: the start that was refused says why in the app's own words, and the next tap is to open Settings (`refused`), until a start runs again.@MainActorfinal class ComposerVoiceRefusalTests: XCTestCase {    func testARefusedStartSaysWhyAndTheNextTapOpensSettings() {        let voice = ComposerVoice(core: BusinessFake()) { VoicePlanRequest(surface: "test", table: "note", column: "body", mode: .dictate) }        XCTAssertFalse(voice.refused)        XCTAssertNil(voice.refusal)        voice.noteHowItStarted(.failed(.denied))        XCTAssertTrue(voice.refused, "the next tap opens Settings")        XCTAssertTrue(voice.refusal?.contains("microphone") == true, "\(voice.refusal ?? "nil")")        voice.noteHowItStarted(.failed(.noMicrophone))        XCTAssertFalse(voice.refused, "only a refused permission sends the person to Settings")        XCTAssertNotNil(voice.refusal)        voice.noteHowItStarted(.listening)        XCTAssertFalse(voice.refused)        XCTAssertNil(voice.refusal)    }}