Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
MacOMNI committed Oct 25, 2024
1 parent 8b38266 commit 529f71c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Networking/Sources/Networking/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public final class Connection<Handler: StreamHandler>: Sendable, ConnectionInfoP
return UInt32(littleEndian: data.withUnsafeBytes { $0.loadUnaligned(as: UInt32.self) })
}

public func request(_ request: Handler.EphemeralHandler.Request) async throws -> [Data] {
public func request(_ request: Handler.EphemeralHandler.Request) async throws -> Data {
let data = try request.encode()
let kind = request.kind
let stream = try createStream(kind: kind)
try stream.send(message: data)

var reps = [Data()]
var reps = Data()
while let nextData = await stream.receive() {
if nextData.isEmpty { // fin flag
break
Expand Down
4 changes: 2 additions & 2 deletions Networking/Tests/NetworkingTests/PeerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ struct PeerTests {
let dataList1 = try await connection1.request(
MockRequest(kind: .typeA, data: Data("hello world".utf8))
)
#expect(dataList1.first == Data("hello world".utf8))
#expect(dataList1 == Data("hello world".utf8))

let connection2 = try peer2.connect(
to: NetAddr(ipAddress: "127.0.0.1", port: 8083)!, role: .validator
Expand All @@ -220,6 +220,6 @@ struct PeerTests {
let dataList2 = try await connection2.request(
MockRequest(kind: .typeB, data: Data("I am jam".utf8))
)
#expect(dataList2.first == Data("I am jam".utf8))
#expect(dataList2 == Data("I am jam".utf8))
}
}

0 comments on commit 529f71c

Please sign in to comment.