-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: track events type in HTTP requests (#117)
- Loading branch information
1 parent
ac66abd
commit 745d4ad
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@testable import CioTracking | ||
import Foundation | ||
import SharedTests | ||
import XCTest | ||
|
||
class TrackRequestBodyTest: UnitTest { | ||
func test_screenview_expectJsonStringApiRequires() { | ||
let attributes = ["logged_in": false] | ||
let given = TrackRequestBody(type: .screen, name: "Dashboard", data: attributes, | ||
timestamp: Date(timeIntervalSince1970: 1642018466)) | ||
let expectedJson = """ | ||
{"data":{"logged_in":false},"name":"Dashboard","timestamp":1642018466,"type":"screen"} | ||
""" | ||
|
||
guard let jsonData = jsonAdapter.toJson(given, encoder: nil), let actualJson = jsonData.string else { | ||
return XCTFail() | ||
} | ||
|
||
print(actualJson) | ||
|
||
XCTAssertEqual(expectedJson, actualJson) | ||
} | ||
} |