Repository Public License
1import Foundation2import Testing3@testable import Diagnostics45@Suite struct RedactorTests {6 @Test func redactsCredentials() {7 let text = #"Authorization: Bearer abcdef123456789 x-api-key=sk-ant-REDACTME0123456789 {"password":"hunter2"} ok"#8 let out = Redactor.redact(text)9 #expect(!out.contains("abcdef123456789"))10 #expect(!out.contains("REDACTME"))11 #expect(!out.contains("hunter2"))12 #expect(out.hasSuffix("ok"))13 }1415 @Test func redactsURLQueryAndUserInfo() {16 let url = URL(string: "https://user:pw@example.com/path?token=abc#frag")!17 #expect(Redactor.redact(url) == "https://example.com/path")18 }1920 @Test func stopwatchMovesForward() async throws {21 let watch = Stopwatch()22 try await Task.sleep(for: .milliseconds(5))23 #expect(watch.milliseconds >= 4)24 }25}26