File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ import Foundation
33public struct TelemetryEnricher {
44 private let deviceID : String
55 private let version : String ?
6-
6+
77 public init ( ) {
88 version = Bundle . main. infoDictionary ? [ " CFBundleShortVersionString " ] as? String
9-
9+
1010 let userDefaults = UserDefaults . standard
1111 let key = " deviceID "
12-
12+
1313 if let existingID = userDefaults. string ( forKey: key) {
1414 deviceID = existingID
1515 } else {
@@ -18,7 +18,7 @@ public struct TelemetryEnricher {
1818 deviceID = newID
1919 }
2020 }
21-
21+
2222 public func enrich( _ original: Vpn_StartRequest ) -> Vpn_StartRequest {
2323 var req = original
2424 req. deviceOs = " macOS "
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import Testing
33
44@Suite ( . timeLimit( . minutes( 1 ) ) )
55struct TelemetryEnricherTests {
6-
76 @Test func testEnrichStartRequest( ) throws {
87 let enricher0 = TelemetryEnricher ( )
98 let original = Vpn_StartRequest . with { req in
@@ -14,7 +13,7 @@ struct TelemetryEnricherTests {
1413 #expect( enriched. coderURL == " https://example.com " )
1514 #expect( enriched. tunnelFileDescriptor == 123 )
1615 #expect( enriched. deviceOs == " macOS " )
17- #expect( enriched. coderDesktopVersion. contains ( try Regex ( #"^\d+\.\d+\.\d+$"# ) ) )
16+ #expect( try enriched. coderDesktopVersion. contains ( Regex ( #"^\d+\.\d+\.\d+$"# ) ) )
1817 let deviceID = enriched. deviceID
1918 #expect( !deviceID. isEmpty)
2019
@@ -23,5 +22,4 @@ struct TelemetryEnricherTests {
2322 enriched = enricher1. enrich ( original)
2423 #expect( enriched. deviceID == deviceID)
2524 }
26-
2725}
You can’t perform that action at this time.
0 commit comments