Skip to content

Commit 17d00ad

Browse files
committed
add tests for dx-link reflection issue
1 parent 4b364e5 commit 17d00ad

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

DXFeedFrameworkTests/DXConnectionTest.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,42 @@ final class DXConnectionTest: XCTestCase {
6060
wait(for: [receivedEventsExpectation], timeout: 4)
6161
}
6262

63+
func testDXLinkConnectionTheoPrice() throws {
64+
// For token-based authorization, use the following address format:
65+
// "dxlink:wss://demo.dxfeed.com/dxlink-ws[login=dxlink:token]"
66+
let endpoint = try DXEndpoint.builder()
67+
.build()
68+
69+
let subscription = try endpoint.getFeed()?.createSubscription(TheoPrice.self)
70+
let receivedEventsExpectation = expectation(description: "Received events")
71+
let eventListener = DXConnectionListener(expectation: receivedEventsExpectation)
72+
try subscription?.add(listener: eventListener)
73+
try subscription?.addSymbols(".AAPL240524C110")
74+
try endpoint.connect("dxlink:wss://demo.dxfeed.com/dxlink-ws")
75+
defer {
76+
try? endpoint.closeAndAwaitTermination()
77+
}
78+
wait(for: [receivedEventsExpectation], timeout: 4)
79+
}
80+
81+
func testDXLinkConnectionGreeks() throws {
82+
// For token-based authorization, use the following address format:
83+
// "dxlink:wss://demo.dxfeed.com/dxlink-ws[login=dxlink:token]"
84+
let endpoint = try DXEndpoint.builder()
85+
.build()
86+
87+
let subscription = try endpoint.getFeed()?.createSubscription(Greeks.self)
88+
let receivedEventsExpectation = expectation(description: "Received events")
89+
let eventListener = DXConnectionListener(expectation: receivedEventsExpectation)
90+
try subscription?.add(listener: eventListener)
91+
try subscription?.addSymbols(".AAPL240524C110")
92+
try endpoint.connect("dxlink:wss://demo.dxfeed.com/dxlink-ws")
93+
defer {
94+
try? endpoint.closeAndAwaitTermination()
95+
}
96+
wait(for: [receivedEventsExpectation], timeout: 4)
97+
}
98+
6399
func testConnection() throws {
64100
// For token-based authorization, use the following address format:
65101
// "demo.dxfeed.com:7300[login=entitle:token]"

0 commit comments

Comments
 (0)