@@ -55,7 +55,7 @@ class ConcurrencyRaceConditionTests: XCTestCase {
5555 XCTAssertTrue ( contextMap. keys. contains ( " timestamp " ) , " Context should contain 'timestamp' attribute " )
5656
5757 if let idValue = contextMap [ " id " ] as? Int64 {
58- let expectedId = Int64 ( targetingKey. replacingOccurrences ( of: " user " , with: " " ) ) !
58+ let expectedId = Int64 ( targetingKey. replacingOccurrences ( of: " user " , with: " " ) )
5959 XCTAssertEqual ( idValue, expectedId, " Context 'id' should match the targeting key number " )
6060 } else {
6161 XCTFail ( " Context 'id' should be an Int64 value " )
@@ -152,14 +152,14 @@ class ConcurrencyRaceConditionTests: XCTestCase {
152152 " Provider status ' \( finalState. providerStatus) ' should be in a valid state after high-frequency operations "
153153 )
154154 if finalState. provider != nil && finalState. evaluationContext != nil {
155- let context = finalState. evaluationContext!
156- let targetingKey = context. getTargetingKey ( )
155+ let context = finalState. evaluationContext
156+ let targetingKey = context? . getTargetingKey ( ) ?? " "
157157 XCTAssertTrue (
158158 targetingKey. hasPrefix ( " rapid-user " ) ,
159159 " Final targeting key ' \( targetingKey) ' should be from the rapid operations if context exists "
160160 )
161161
162- let contextMap = context. asObjectMap ( )
162+ let contextMap = context? . asObjectMap ( ) ?? [ : ]
163163 if contextMap. keys. contains ( " iteration " ) {
164164 XCTAssertTrue ( contextMap. keys. contains ( " timestamp " ) , " Context with iteration should also have timestamp " )
165165 }
0 commit comments