@@ -60,7 +60,8 @@ - (void)testAppliesSetsToDocuments {
60
60
FSTDocument *baseDoc = FSTTestDoc (" collection/key" , 0 , docData, NO );
61
61
62
62
FSTMutation *set = FSTTestSetMutation (@" collection/key" , @{@" bar" : @" bar-value" });
63
- FSTMaybeDocument *setDoc = [set applyTo: baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
63
+ FSTMaybeDocument *setDoc =
64
+ [set applyToLocalDocument: baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
64
65
65
66
NSDictionary *expectedData = @{@" bar" : @" bar-value" };
66
67
XCTAssertEqualObjects (setDoc, FSTTestDoc (" collection/key" , 0 , expectedData, YES ));
@@ -72,7 +73,7 @@ - (void)testAppliesPatchesToDocuments {
72
73
73
74
FSTMutation *patch = FSTTestPatchMutation (" collection/key" , @{@" foo.bar" : @" new-bar-value" }, {});
74
75
FSTMaybeDocument *patchedDoc =
75
- [patch applyTo : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
76
+ [patch applyToLocalDocument : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
76
77
77
78
NSDictionary *expectedData = @{@" foo" : @{@" bar" : @" new-bar-value" }, @" baz" : @" baz-value" };
78
79
XCTAssertEqualObjects (patchedDoc, FSTTestDoc (" collection/key" , 0 , expectedData, YES ));
@@ -88,7 +89,7 @@ - (void)testDeletesValuesFromTheFieldMask {
88
89
value: [FSTObjectValue objectValue ]
89
90
precondition:Precondition: :None ()];
90
91
FSTMaybeDocument *patchedDoc =
91
- [patch applyTo : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
92
+ [patch applyToLocalDocument : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
92
93
93
94
NSDictionary *expectedData = @{@" foo" : @{@" baz" : @" baz-value" }};
94
95
XCTAssertEqualObjects (patchedDoc, FSTTestDoc (" collection/key" , 0 , expectedData, YES ));
@@ -100,7 +101,7 @@ - (void)testPatchesPrimitiveValue {
100
101
101
102
FSTMutation *patch = FSTTestPatchMutation (" collection/key" , @{@" foo.bar" : @" new-bar-value" }, {});
102
103
FSTMaybeDocument *patchedDoc =
103
- [patch applyTo : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
104
+ [patch applyToLocalDocument : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
104
105
105
106
NSDictionary *expectedData = @{@" foo" : @{@" bar" : @" new-bar-value" }, @" baz" : @" baz-value" };
106
107
XCTAssertEqualObjects (patchedDoc, FSTTestDoc (" collection/key" , 0 , expectedData, YES ));
@@ -110,7 +111,7 @@ - (void)testPatchingDeletedDocumentsDoesNothing {
110
111
FSTMaybeDocument *baseDoc = FSTTestDeletedDoc (" collection/key" , 0 );
111
112
FSTMutation *patch = FSTTestPatchMutation (" collection/key" , @{@" foo" : @" bar" }, {});
112
113
FSTMaybeDocument *patchedDoc =
113
- [patch applyTo : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
114
+ [patch applyToLocalDocument : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
114
115
XCTAssertEqualObjects (patchedDoc, baseDoc);
115
116
}
116
117
@@ -121,7 +122,7 @@ - (void)testAppliesLocalServerTimestampTransformToDocuments {
121
122
FSTMutation *transform = FSTTestTransformMutation (
122
123
@" collection/key" , @{@" foo.bar" : [FIRFieldValue fieldValueForServerTimestamp ]});
123
124
FSTMaybeDocument *transformedDoc =
124
- [transform applyTo : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
125
+ [transform applyToLocalDocument : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
125
126
126
127
// Server timestamps aren't parsed, so we manually insert it.
127
128
FSTObjectValue *expectedData = FSTTestObjectValue (
@@ -297,7 +298,7 @@ - (void)transformBaseDoc:(NSDictionary<NSString *, id> *)baseData
297
298
FSTMutation *transform = FSTTestTransformMutation (@" collection/key" , transformData);
298
299
299
300
FSTMaybeDocument *transformedDoc =
300
- [transform applyTo : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
301
+ [transform applyToLocalDocument : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
301
302
302
303
FSTDocument *expectedDoc = [FSTDocument documentWithData: FSTTestObjectValue (expectedData)
303
304
key: FSTTestDocKey (@" collection/key" )
@@ -318,10 +319,8 @@ - (void)testAppliesServerAckedServerTimestampTransformToDocuments {
318
319
initWithVersion: testutil: :Version (1 )
319
320
transformResults: @[ [FSTTimestampValue timestampValue: _timestamp] ]];
320
321
321
- FSTMaybeDocument *transformedDoc = [transform applyTo: baseDoc
322
- baseDocument: baseDoc
323
- localWriteTime: _timestamp
324
- mutationResult: mutationResult];
322
+ FSTMaybeDocument *transformedDoc =
323
+ [transform applyToRemoteDocument: baseDoc mutationResult: mutationResult];
325
324
326
325
NSDictionary *expectedData = @{@" foo" : @{@" bar" : _timestamp.dateValue }, @" baz" : @" baz-value" };
327
326
XCTAssertEqualObjects (transformedDoc, FSTTestDoc (" collection/key" , 0 , expectedData, NO ));
@@ -341,10 +340,8 @@ - (void)testAppliesServerAckedArrayTransformsToDocuments {
341
340
initWithVersion: testutil: :Version (1 )
342
341
transformResults: @[ [FSTNullValue nullValue ], [FSTNullValue nullValue ] ]];
343
342
344
- FSTMaybeDocument *transformedDoc = [transform applyTo: baseDoc
345
- baseDocument: baseDoc
346
- localWriteTime: _timestamp
347
- mutationResult: mutationResult];
343
+ FSTMaybeDocument *transformedDoc =
344
+ [transform applyToRemoteDocument: baseDoc mutationResult: mutationResult];
348
345
349
346
NSDictionary *expectedData = @{@" array_1" : @[ @1 , @2 , @3 ], @" array_2" : @[ @" b" ]};
350
347
XCTAssertEqualObjects (transformedDoc, FSTTestDoc (" collection/key" , 0 , expectedData, NO ));
@@ -356,7 +353,7 @@ - (void)testDeleteDeletes {
356
353
357
354
FSTMutation *mutation = FSTTestDeleteMutation (@" collection/key" );
358
355
FSTMaybeDocument *result =
359
- [mutation applyTo : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
356
+ [mutation applyToLocalDocument : baseDoc baseDocument: baseDoc localWriteTime: _timestamp];
360
357
XCTAssertEqualObjects (result, FSTTestDeletedDoc (" collection/key" , 0 ));
361
358
}
362
359
@@ -367,10 +364,7 @@ - (void)testSetWithMutationResult {
367
364
FSTMutation *set = FSTTestSetMutation (@" collection/key" , @{@" foo" : @" new-bar" });
368
365
FSTMutationResult *mutationResult =
369
366
[[FSTMutationResult alloc ] initWithVersion: testutil: :Version (4 ) transformResults: nil ];
370
- FSTMaybeDocument *setDoc = [set applyTo: baseDoc
371
- baseDocument: baseDoc
372
- localWriteTime: _timestamp
373
- mutationResult: mutationResult];
367
+ FSTMaybeDocument *setDoc = [set applyToRemoteDocument: baseDoc mutationResult: mutationResult];
374
368
375
369
NSDictionary *expectedData = @{@" foo" : @" new-bar" };
376
370
XCTAssertEqualObjects (setDoc, FSTTestDoc (" collection/key" , 0 , expectedData, NO ));
@@ -383,10 +377,8 @@ - (void)testPatchWithMutationResult {
383
377
FSTMutation *patch = FSTTestPatchMutation (" collection/key" , @{@" foo" : @" new-bar" }, {});
384
378
FSTMutationResult *mutationResult =
385
379
[[FSTMutationResult alloc ] initWithVersion: testutil: :Version (4 ) transformResults: nil ];
386
- FSTMaybeDocument *patchedDoc = [patch applyTo: baseDoc
387
- baseDocument: baseDoc
388
- localWriteTime: _timestamp
389
- mutationResult: mutationResult];
380
+ FSTMaybeDocument *patchedDoc =
381
+ [patch applyToRemoteDocument: baseDoc mutationResult: mutationResult];
390
382
391
383
NSDictionary *expectedData = @{@" foo" : @" new-bar" };
392
384
XCTAssertEqualObjects (patchedDoc, FSTTestDoc (" collection/key" , 0 , expectedData, NO ));
@@ -396,10 +388,8 @@ - (void)testPatchWithMutationResult {
396
388
do { \
397
389
FSTMutationResult *mutationResult = \
398
390
[[FSTMutationResult alloc ] initWithVersion: testutil: :Version (0 ) transformResults: nil ]; \
399
- FSTMaybeDocument *actual = [mutation applyTo: base \
400
- baseDocument: base \
401
- localWriteTime: _timestamp \
402
- mutationResult: mutationResult]; \
391
+ FSTMaybeDocument *actual = \
392
+ [mutation applyToRemoteDocument: base mutationResult: mutationResult]; \
403
393
XCTAssertEqualObjects (actual, expected); \
404
394
} while (0 );
405
395
0 commit comments