Skip to content

Commit cccd5de

Browse files
committed
EventStreams: remove eventCountOffset in Test_ServerSentEventsDecoding
1 parent 6f8940e commit cccd5de

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Tests/OpenAPIRuntimeTests/EventStreams/Test_ServerSentEventsDecoding.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ import XCTest
1616
import Foundation
1717

1818
final class Test_ServerSentEventsDecoding: Test_Runtime {
19-
func _test(input: String, output: [ServerSentEvent], file: StaticString = #filePath, line: UInt = #line, while predicate: (ArraySlice<UInt8>) -> Bool = { _ in true }, eventCountOffset: Int = 0)
19+
func _test(input: String, output: [ServerSentEvent], file: StaticString = #filePath, line: UInt = #line, while predicate: @escaping @Sendable (ArraySlice<UInt8>) -> Bool = { _ in true })
2020
async throws
2121
{
22-
let sequence = asOneBytePerElementSequence(ArraySlice(input.utf8)).asDecodedServerSentEvents()
22+
let sequence = asOneBytePerElementSequence(ArraySlice(input.utf8)).asDecodedServerSentEvents(while: predicate)
2323
let events = try await [ServerSentEvent](collecting: sequence)
24-
let eventCount = events.count + eventCountOffset
25-
XCTAssertEqual(eventCount, output.count, file: file, line: line)
24+
XCTAssertEqual(events.count, output.count, file: file, line: line)
2625
for (index, linePair) in zip(events, output).enumerated() {
2726
let (actualEvent, expectedEvent) = linePair
2827
XCTAssertEqual(actualEvent, expectedEvent, "Event: \(index)", file: file, line: line)
@@ -103,8 +102,7 @@ final class Test_ServerSentEventsDecoding: Test_Runtime {
103102
],
104103
while: { incomingData in
105104
incomingData != ArraySlice<UInt8>(Data("[DONE]".utf8))
106-
},
107-
eventCountOffset: -2
105+
}
108106
)
109107
}
110108
func _testJSONData<JSONType: Decodable & Hashable & Sendable>(

0 commit comments

Comments
 (0)