From 2372267d1bbed7666f458142d1d26a4dbd94c65c Mon Sep 17 00:00:00 2001 From: MacOMNI <414294494@qq.com> Date: Tue, 26 Nov 2024 14:39:57 +0800 Subject: [PATCH] update coverage --- .../Tests/NetworkingTests/PKCS12Tests.swift | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/Networking/Tests/NetworkingTests/PKCS12Tests.swift b/Networking/Tests/NetworkingTests/PKCS12Tests.swift index 19b5801d..8523a531 100644 --- a/Networking/Tests/NetworkingTests/PKCS12Tests.swift +++ b/Networking/Tests/NetworkingTests/PKCS12Tests.swift @@ -27,8 +27,8 @@ struct PKCS12Tests { let registration = try QuicRegistration() - let serverHandler = MockQuicEventHandler() - let clientHandler = MockQuicEventHandler() + let serverHandler = MockPeerEventTests.MockPeerEventHandler() + let clientHandler = MockPeerEventTests.MockPeerEventHandler() // create listener @@ -71,26 +71,20 @@ struct PKCS12Tests { try? await Task.sleep(for: .milliseconds(50)) - let clientData = clientHandler.events.value.compactMap { - switch $0 { - case let .shouldOpen(_, certificate): - certificate as Data? - default: - nil + let clientConn = clientHandler.events.value.compactMap { + if case let .connected(connection: connection) = $0 { + return connection } - } - - #expect(clientData.first!.count > 0) + return nil + }.first! + #expect(clientConn != nil) - let serverData = serverHandler.events.value.compactMap { - switch $0 { - case let .shouldOpen(_, certificate): - certificate as Data? - default: - nil + let serverConn = serverHandler.events.value.compactMap { + if case let .connected(connection: connection) = $0 { + return connection } - } - - #expect(serverData.first!.count > 0) + return nil + }.first! + #expect(serverConn != nil) } }