vibetunnel/VibeTunnelTests/AuthCacheClearingTests.swift
2025-06-19 01:39:27 +02:00

49 lines
No EOL
1.7 KiB
Swift

import Testing
import Foundation
import HTTPTypes
import Hummingbird
@testable import VibeTunnel
@Suite("Authentication Cache Clearing Tests")
struct AuthCacheClearingTests {
@Test("Auth cache clearing mechanism exists")
func testAuthCacheClearingMechanismExists() async throws {
// This test verifies that the authentication cache clearing mechanism
// exists and is properly integrated into the system
// Create a mock middleware instance
let middleware = LazyBasicAuthMiddleware<BasicRequestContext>()
// Clear the cache - this should complete without error
await middleware.clearCache()
// The test passes if clearCache completes without error
// We can't directly test the private cache, but we've verified
// the mechanism exists and is called from the UI
}
@Test("ServerManager clears auth cache for Hummingbird server")
@MainActor
func testServerManagerClearsAuthCache() async throws {
// This test can't run the full server in unit tests,
// but we can verify the clearAuthCache method exists
// Just verify the method exists and can be called
await ServerManager.shared.clearAuthCache()
// The test passes if clearAuthCache completes without error
}
@Test("HummingbirdServer has clearAuthCache method")
@MainActor
func testHummingbirdServerHasClearAuthCache() async throws {
let server = HummingbirdServer()
// Clear the auth cache - even without a running server,
// this should complete without error
await server.clearAuthCache()
// The test passes if clearAuthCache completes without error
}
}