@@ -81,33 +81,35 @@ struct InternalDefaultLiveMapTests {
8181 #expect( result? . numberValue == 123.456 )
8282 }
8383
84- // @specOneOf(1/3) RTLM5d2e - When `string` is a string
84+ // @spec RTLM5d2e
8585 @Test
8686 func returnsStringValue( ) throws {
8787 let logger = TestLogger ( )
88- let entry = TestFactories . internalMapEntry ( data: ObjectData ( string: . string ( " test " ) ) )
88+ let entry = TestFactories . internalMapEntry ( data: ObjectData ( string: " test " ) )
8989 let coreSDK = MockCoreSDK ( channelState: . attaching)
9090 let map = InternalDefaultLiveMap ( testsOnly_data: [ " key " : entry] , objectID: " arbitrary " , logger: logger, userCallbackQueue: . main, clock: MockSimpleClock ( ) )
9191 let result = try map. get ( key: " key " , coreSDK: coreSDK, delegate: MockLiveMapObjectPoolDelegate ( ) )
9292 #expect( result? . stringValue == " test " )
9393 }
9494
95- // @specOneOf(2/3) RTLM5d2e - When `string` is a JSON array
95+ // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
96+ // Tests when `json` is a JSON array
9697 @Test
9798 func returnsJSONArrayValue( ) throws {
9899 let logger = TestLogger ( )
99- let entry = TestFactories . internalMapEntry ( data: ObjectData ( string : . json ( . array( [ " foo " ] ) ) ) )
100+ let entry = TestFactories . internalMapEntry ( data: ObjectData ( json : . array( [ " foo " ] ) ) )
100101 let coreSDK = MockCoreSDK ( channelState: . attaching)
101102 let map = InternalDefaultLiveMap ( testsOnly_data: [ " key " : entry] , objectID: " arbitrary " , logger: logger, userCallbackQueue: . main, clock: MockSimpleClock ( ) )
102103 let result = try map. get ( key: " key " , coreSDK: coreSDK, delegate: MockLiveMapObjectPoolDelegate ( ) )
103104 #expect( result? . jsonArrayValue == [ " foo " ] )
104105 }
105106
106- // @specOneOf(3/3) RTLM5d2e - When `string` is a JSON object
107+ // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
108+ // Tests when `json` is a JSON object
107109 @Test
108110 func returnsJSONObjectValue( ) throws {
109111 let logger = TestLogger ( )
110- let entry = TestFactories . internalMapEntry ( data: ObjectData ( string : . json ( . object( [ " foo " : " bar " ] ) ) ) )
112+ let entry = TestFactories . internalMapEntry ( data: ObjectData ( json : . object( [ " foo " : " bar " ] ) ) )
111113 let coreSDK = MockCoreSDK ( channelState: . attaching)
112114 let map = InternalDefaultLiveMap ( testsOnly_data: [ " key " : entry] , objectID: " arbitrary " , logger: logger, userCallbackQueue: . main, clock: MockSimpleClock ( ) )
113115 let result = try map. get ( key: " key " , coreSDK: coreSDK, delegate: MockLiveMapObjectPoolDelegate ( ) )
@@ -316,11 +318,11 @@ struct InternalDefaultLiveMapTests {
316318 let map = InternalDefaultLiveMap (
317319 testsOnly_data: [
318320 // tombstone is nil, so not considered tombstoned
319- " active1 " : TestFactories . internalMapEntry ( data: ObjectData ( string: . string ( " value1 " ) ) ) ,
321+ " active1 " : TestFactories . internalMapEntry ( data: ObjectData ( string: " value1 " ) ) ,
320322 // tombstone is false, so not considered tombstoned[
321- " active2 " : TestFactories . internalMapEntry ( tombstone: false , data: ObjectData ( string: . string ( " value2 " ) ) ) ,
322- " tombstoned " : TestFactories . internalMapEntry ( tombstone: true , data: ObjectData ( string: . string ( " tombstoned " ) ) ) ,
323- " tombstoned2 " : TestFactories . internalMapEntry ( tombstone: true , data: ObjectData ( string: . string ( " tombstoned2 " ) ) ) ,
323+ " active2 " : TestFactories . internalMapEntry ( tombstone: false , data: ObjectData ( string: " value2 " ) ) ,
324+ " tombstoned " : TestFactories . internalMapEntry ( tombstone: true , data: ObjectData ( string: " tombstoned " ) ) ,
325+ " tombstoned2 " : TestFactories . internalMapEntry ( tombstone: true , data: ObjectData ( string: " tombstoned2 " ) ) ,
324326 ] ,
325327 objectID: " arbitrary " ,
326328 logger: logger,
@@ -362,9 +364,9 @@ struct InternalDefaultLiveMapTests {
362364 let delegate = MockLiveMapObjectPoolDelegate ( )
363365 let map = InternalDefaultLiveMap (
364366 testsOnly_data: [
365- " key1 " : TestFactories . internalMapEntry ( data: ObjectData ( string: . string ( " value1 " ) ) ) ,
366- " key2 " : TestFactories . internalMapEntry ( data: ObjectData ( string: . string ( " value2 " ) ) ) ,
367- " key3 " : TestFactories . internalMapEntry ( data: ObjectData ( string: . string ( " value3 " ) ) ) ,
367+ " key1 " : TestFactories . internalMapEntry ( data: ObjectData ( string: " value1 " ) ) ,
368+ " key2 " : TestFactories . internalMapEntry ( data: ObjectData ( string: " value2 " ) ) ,
369+ " key3 " : TestFactories . internalMapEntry ( data: ObjectData ( string: " value3 " ) ) ,
368370 ] ,
369371 objectID: " arbitrary " ,
370372 logger: logger,
@@ -410,9 +412,9 @@ struct InternalDefaultLiveMapTests {
410412 " boolean " : TestFactories . internalMapEntry ( data: ObjectData ( boolean: true ) ) , // RTLM5d2b
411413 " bytes " : TestFactories . internalMapEntry ( data: ObjectData ( bytes: Data ( [ 0x01 , 0x02 , 0x03 ] ) ) ) , // RTLM5d2c
412414 " number " : TestFactories . internalMapEntry ( data: ObjectData ( number: NSNumber ( value: 42 ) ) ) , // RTLM5d2d
413- " string " : TestFactories . internalMapEntry ( data: ObjectData ( string: . string ( " hello " ) ) ) , // RTLM5d2e
414- " jsonArray " : TestFactories . internalMapEntry ( data: ObjectData ( string : . json ( . array( [ " foo " ] ) ) ) ) , // RTLM5d2e
415- " jsonObject " : TestFactories . internalMapEntry ( data: ObjectData ( string : . json ( . object( [ " foo " : " bar " ] ) ) ) ) , // RTLM5d2e
415+ " string " : TestFactories . internalMapEntry ( data: ObjectData ( string: " hello " ) ) , // RTLM5d2e
416+ " jsonArray " : TestFactories . internalMapEntry ( data: ObjectData ( json : . array( [ " foo " ] ) ) ) , // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
417+ " jsonObject " : TestFactories . internalMapEntry ( data: ObjectData ( json : . object( [ " foo " : " bar " ] ) ) ) , // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
416418 " mapRef " : TestFactories . internalMapEntry ( data: ObjectData ( objectId: " map:ref@123 " ) ) , // RTLM5d2f2
417419 " counterRef " : TestFactories . internalMapEntry ( data: ObjectData ( objectId: " counter:ref@456 " ) ) , // RTLM5d2f2
418420 ] ,
@@ -465,7 +467,7 @@ struct InternalDefaultLiveMapTests {
465467 let delegate = MockLiveMapObjectPoolDelegate ( )
466468 let coreSDK = MockCoreSDK ( channelState: . attaching)
467469 let map = InternalDefaultLiveMap (
468- testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( timeserial: " ts2 " , data: ObjectData ( string: . string ( " existing " ) ) ) ] ,
470+ testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( timeserial: " ts2 " , data: ObjectData ( string: " existing " ) ) ] ,
469471 objectID: " arbitrary " ,
470472 logger: logger,
471473 userCallbackQueue: . main,
@@ -505,7 +507,7 @@ struct InternalDefaultLiveMapTests {
505507 let delegate = MockLiveMapObjectPoolDelegate ( )
506508 let coreSDK = MockCoreSDK ( channelState: . attaching)
507509 let map = InternalDefaultLiveMap (
508- testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( tombstone: true , timeserial: " ts1 " , data: ObjectData ( string: . string ( " existing " ) ) ) ] ,
510+ testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( tombstone: true , timeserial: " ts1 " , data: ObjectData ( string: " existing " ) ) ] ,
509511 objectID: " arbitrary " ,
510512 logger: logger,
511513 userCallbackQueue: . main,
@@ -677,7 +679,7 @@ struct InternalDefaultLiveMapTests {
677679 let delegate = MockLiveMapObjectPoolDelegate ( )
678680 let coreSDK = MockCoreSDK ( channelState: . attaching)
679681 let map = InternalDefaultLiveMap (
680- testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( timeserial: " ts2 " , data: ObjectData ( string: . string ( " existing " ) ) ) ] ,
682+ testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( timeserial: " ts2 " , data: ObjectData ( string: " existing " ) ) ] ,
681683 objectID: " arbitrary " ,
682684 logger: logger,
683685 userCallbackQueue: . main,
@@ -703,7 +705,7 @@ struct InternalDefaultLiveMapTests {
703705 let delegate = MockLiveMapObjectPoolDelegate ( )
704706 let coreSDK = MockCoreSDK ( channelState: . attaching)
705707 let map = InternalDefaultLiveMap (
706- testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( tombstone: false , timeserial: " ts1 " , data: ObjectData ( string: . string ( " existing " ) ) ) ] ,
708+ testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( tombstone: false , timeserial: " ts1 " , data: ObjectData ( string: " existing " ) ) ] ,
707709 objectID: " arbitrary " ,
708710 logger: logger,
709711 userCallbackQueue: . main,
@@ -828,7 +830,7 @@ struct InternalDefaultLiveMapTests {
828830 let delegate = MockLiveMapObjectPoolDelegate ( )
829831 let coreSDK = MockCoreSDK ( channelState: . attaching)
830832 let map = InternalDefaultLiveMap (
831- testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( timeserial: entrySerial, data: ObjectData ( string: . string ( " existing " ) ) ) ] ,
833+ testsOnly_data: [ " key1 " : TestFactories . internalMapEntry ( timeserial: entrySerial, data: ObjectData ( string: " existing " ) ) ] ,
832834 objectID: " arbitrary " ,
833835 logger: logger,
834836 userCallbackQueue: . main,
@@ -839,7 +841,7 @@ struct InternalDefaultLiveMapTests {
839841 _ = map. testsOnly_applyMapSetOperation (
840842 key: " key1 " ,
841843 operationTimeserial: operationSerial,
842- operationData: ObjectData ( string: . string ( " new " ) ) ,
844+ operationData: ObjectData ( string: " new " ) ,
843845 objectsPool: & pool,
844846 )
845847
@@ -1049,7 +1051,7 @@ struct InternalDefaultLiveMapTests {
10491051
10501052 let operation = TestFactories . objectOperation (
10511053 action: . known( . mapSet) ,
1052- mapOp: ObjectsMapOp ( key: " key1 " , data: ObjectData ( string: . string ( " new " ) ) ) ,
1054+ mapOp: ObjectsMapOp ( key: " key1 " , data: ObjectData ( string: " new " ) ) ,
10531055 )
10541056
10551057 // Apply operation with serial "ts1" which is lexicographically less than existing "ts2" and thus will be applied per RTLO4a (this is a non-pathological case of RTOL4a, that spec point being fully tested elsewhere)
@@ -1136,7 +1138,7 @@ struct InternalDefaultLiveMapTests {
11361138
11371139 let operation = TestFactories . objectOperation (
11381140 action: . known( . mapSet) ,
1139- mapOp: ObjectsMapOp ( key: " key1 " , data: ObjectData ( string: . string ( " new " ) ) ) ,
1141+ mapOp: ObjectsMapOp ( key: " key1 " , data: ObjectData ( string: " new " ) ) ,
11401142 )
11411143
11421144 // Apply MAP_SET operation
0 commit comments