Skip to content

Commit 3c3e415

Browse files
committed
Add test case for non null response without data envelope
1 parent a7b8c3c commit 3c3e415

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Networking/NetworkingTests/Remote/TelemetryRemoteTests.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import XCTest
44

55
/// TelemetryRemote Unit Tests
66
///
7-
class TelemetryRemoteTests: XCTestCase {
7+
final class TelemetryRemoteTests: XCTestCase {
88

99
/// Dummy Network Wrapper
1010
///
@@ -56,6 +56,24 @@ class TelemetryRemoteTests: XCTestCase {
5656
XCTAssertTrue(result.isSuccess)
5757
}
5858

59+
/// Verifies that sendTelemetry properly accepts non-null response without data envelope.
60+
///
61+
func test_sendTelemetry_properly_accepts_non_null_response_without_data_envelope() throws {
62+
// Given
63+
let remote = TelemetryRemote(network: network)
64+
network.simulateResponse(requestUrlSuffix: "tracker", filename: "generic_success")
65+
66+
// When
67+
let result: Result<Void, Error> = waitFor { promise in
68+
remote.sendTelemetry(for: self.sampleSiteID, versionString: "1.2") { result in
69+
promise(result)
70+
}
71+
}
72+
73+
// Then
74+
XCTAssertTrue(result.isSuccess)
75+
}
76+
5977
/// Verifies that sendTelemetry properly relays Networking Layer errors.
6078
///
6179
func test_sendTelemetry_properly_relays_networking_errors() {

0 commit comments

Comments
 (0)