File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
Sources/Segment/Utilities Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ internal struct UserAgent {
8484 #endif
8585
8686 #else
87+ // tvos has no user agent.
8788 return " unknown "
8889 #endif
8990 }
Original file line number Diff line number Diff line change 55// Created by Brandon Sneed on 11/4/21.
66//
77
8- #if !os(Linux) && !os(tvOS) && !os(watchOS) && !os(Windows)
8+ #if !os(Linux) && !os(tvOS) && !os(watchOS) && !os(visionOS) && !os( Windows)
99
1010import XCTest
1111@testable import Segment
@@ -38,6 +38,10 @@ class StressTests: XCTestCase {
3838
3939 DirectoryStore . fileValidator = { url in
4040 do {
41+ if FileManager . default. fileExists ( atPath: url. path) == false {
42+ XCTFail ( " File doesn't exist when it should! \( url) " )
43+ return
44+ }
4145 let eventBundle = try JSONSerialization . jsonObject ( with: Data ( contentsOf: url) )
4246 XCTAssertNotNil ( eventBundle, " The event bundle parsed out to null. \( url) " )
4347 } catch {
@@ -117,6 +121,10 @@ class StressTests: XCTestCase {
117121
118122 DirectoryStore . fileValidator = { url in
119123 do {
124+ if FileManager . default. fileExists ( atPath: url. path) == false {
125+ XCTFail ( " File doesn't exist when it should! \( url) " )
126+ return
127+ }
120128 let eventBundle = try JSONSerialization . jsonObject ( with: Data ( contentsOf: url) )
121129 XCTAssertNotNil ( eventBundle, " The event bundle parsed out to null. \( url) " )
122130 } catch {
Original file line number Diff line number Diff line change @@ -55,10 +55,19 @@ final class UserAgentTests: XCTestCase {
5555 print ( " Generated UserAgent: \( userAgent) " )
5656 }
5757
58+ #if !os(tvOS) && !os(watchOS)
5859 func testUserAgentWithCustomAppName( ) throws {
60+ /*#if canImport(WebKit)
61+ let wkUserAgent = WKWebView().value(forKey: "userAgent") as! String
62+ #else
63+ let wkUserAgent = "unknown"
64+ #endif
65+ print(wkUserAgent)*/
66+
5967 let customUA = UserAgent . value ( applicationName: " MyApp/1.0 " )
6068 XCTAssertTrue ( customUA. contains ( " MyApp/1.0 " ) , " Should contain custom app name " )
6169 }
70+ #endif
6271
6372 func testUserAgentCaching( ) throws {
6473 let ua1 = UserAgent . value
You can’t perform that action at this time.
0 commit comments