@@ -145,8 +145,7 @@ - (void)testGetDocumentWhileOnlineCacheOnly {
145
145
// get doc and ensure that it exists, *is* from the cache, and matches
146
146
// the initialData.
147
147
FIRDocumentSnapshot *result =
148
- [self readDocumentForRef: doc
149
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
148
+ [self readDocumentForRef: doc options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
150
149
XCTAssertTrue (result.exists );
151
150
XCTAssertTrue (result.metadata .fromCache );
152
151
XCTAssertFalse (result.metadata .hasPendingWrites );
@@ -167,8 +166,7 @@ - (void)testGetCollectionWhileOnlineCacheOnly {
167
166
// get docs and ensure they *are* from the cache, and matches the
168
167
// initialDocs.
169
168
FIRQuerySnapshot *result =
170
- [self readDocumentSetForRef: col
171
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
169
+ [self readDocumentSetForRef: col options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
172
170
XCTAssertTrue (result.metadata .fromCache );
173
171
XCTAssertFalse (result.metadata .hasPendingWrites );
174
172
XCTAssertEqualObjects (FIRQuerySnapshotGetData (result), (@[
@@ -205,8 +203,7 @@ - (void)testGetDocumentWhileOfflineCacheOnly {
205
203
// get doc and ensure it exists, *is* from the cache, and matches the
206
204
// newData.
207
205
FIRDocumentSnapshot *result =
208
- [self readDocumentForRef: doc
209
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
206
+ [self readDocumentForRef: doc options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
210
207
XCTAssertTrue (result.exists );
211
208
XCTAssertTrue (result.metadata .fromCache );
212
209
XCTAssertTrue (result.metadata .hasPendingWrites );
@@ -237,8 +234,7 @@ - (void)testGetCollectionWhileOfflineCacheOnly {
237
234
// get docs and ensure they *are* from the cache, and matches the updated
238
235
// data.
239
236
FIRQuerySnapshot *result =
240
- [self readDocumentSetForRef: col
241
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
237
+ [self readDocumentSetForRef: col options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
242
238
XCTAssertTrue (result.metadata .fromCache );
243
239
XCTAssertTrue (result.metadata .hasPendingWrites );
244
240
XCTAssertEqualObjects (FIRQuerySnapshotGetData (result), (@[
@@ -264,8 +260,7 @@ - (void)testGetDocumentWhileOnlineServerOnly {
264
260
// get doc and ensure that it exists, is *not* from the cache, and matches
265
261
// the initialData.
266
262
FIRDocumentSnapshot *result =
267
- [self readDocumentForRef: doc
268
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceServer]];
263
+ [self readDocumentForRef: doc options: [FIRGetOptions optionsWithSource: FIRGetSourceServer]];
269
264
XCTAssertTrue (result.exists );
270
265
XCTAssertFalse (result.metadata .fromCache );
271
266
XCTAssertFalse (result.metadata .hasPendingWrites );
@@ -286,8 +281,7 @@ - (void)testGetCollectionWhileOnlineServerOnly {
286
281
// get docs and ensure they are *not* from the cache, and matches the
287
282
// initialData.
288
283
FIRQuerySnapshot *result =
289
- [self readDocumentSetForRef: col
290
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceServer]];
284
+ [self readDocumentSetForRef: col options: [FIRGetOptions optionsWithSource: FIRGetSourceServer]];
291
285
XCTAssertFalse (result.metadata .fromCache );
292
286
XCTAssertFalse (result.metadata .hasPendingWrites );
293
287
XCTAssertEqualObjects (FIRQuerySnapshotGetData (result), (@[
@@ -314,7 +308,7 @@ - (void)testGetDocumentWhileOfflineServerOnly {
314
308
315
309
// attempt to get doc and ensure it cannot be retreived
316
310
XCTestExpectation *failedGetDocCompletion = [self expectationWithDescription: @" failedGetDoc" ];
317
- [doc getDocumentWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceServer]
311
+ [doc getDocumentWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceServer]
318
312
completion: ^(FIRDocumentSnapshot *snapshot, NSError *error) {
319
313
XCTAssertNotNil (error);
320
314
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
@@ -340,7 +334,7 @@ - (void)testGetCollectionWhileOfflineServerOnly {
340
334
341
335
// attempt to get docs and ensure they cannot be retreived
342
336
XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription: @" failedGetDocs" ];
343
- [col getDocumentsWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceServer]
337
+ [col getDocumentsWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceServer]
344
338
completion: ^(FIRQuerySnapshot *snapshot, NSError *error) {
345
339
XCTAssertNotNil (error);
346
340
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
@@ -380,24 +374,23 @@ - (void)testGetDocumentWhileOfflineWithDifferentGetOptions {
380
374
// get doc (from cache) and ensure it exists, *is* from the cache, and
381
375
// matches the newData.
382
376
FIRDocumentSnapshot *result =
383
- [self readDocumentForRef: doc
384
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
377
+ [self readDocumentForRef: doc options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
385
378
XCTAssertTrue (result.exists );
386
379
XCTAssertTrue (result.metadata .fromCache );
387
380
XCTAssertTrue (result.metadata .hasPendingWrites );
388
381
XCTAssertEqualObjects (result.data , newData);
389
382
390
383
// attempt to get doc (with default get options)
391
- result = [ self readDocumentForRef: doc
392
- options: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceDefault]];
384
+ result =
385
+ [ self readDocumentForRef: doc options: [FIRGetOptions optionsWithSource : FIRGetSourceDefault]];
393
386
XCTAssertTrue (result.exists );
394
387
XCTAssertTrue (result.metadata .fromCache );
395
388
XCTAssertTrue (result.metadata .hasPendingWrites );
396
389
XCTAssertEqualObjects (result.data , newData);
397
390
398
391
// attempt to get doc (from the server) and ensure it cannot be retreived
399
392
XCTestExpectation *failedGetDocCompletion = [self expectationWithDescription: @" failedGetDoc" ];
400
- [doc getDocumentWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceServer]
393
+ [doc getDocumentWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceServer]
401
394
completion: ^(FIRDocumentSnapshot *snapshot, NSError *error) {
402
395
XCTAssertNotNil (error);
403
396
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
@@ -440,8 +433,7 @@ - (void)testGetCollectionWhileOfflineWithDifferentGetOptions {
440
433
// get docs (from cache) and ensure they *are* from the cache, and
441
434
// matches the updated data.
442
435
FIRQuerySnapshot *result =
443
- [self readDocumentSetForRef: col
444
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
436
+ [self readDocumentSetForRef: col options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
445
437
XCTAssertTrue (result.metadata .fromCache );
446
438
XCTAssertTrue (result.metadata .hasPendingWrites );
447
439
XCTAssertEqualObjects (FIRQuerySnapshotGetData (result), (@[
@@ -458,7 +450,7 @@ - (void)testGetCollectionWhileOfflineWithDifferentGetOptions {
458
450
459
451
// attempt to get docs (with default get options)
460
452
result = [self readDocumentSetForRef: col
461
- options: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceDefault]];
453
+ options: [FIRGetOptions optionsWithSource : FIRGetSourceDefault]];
462
454
XCTAssertTrue (result.metadata .fromCache );
463
455
XCTAssertEqualObjects (FIRQuerySnapshotGetData (result), (@[
464
456
@{@" key1" : @" value1" }, @{@" key2" : @" value2" , @" key2b" : @" value2b" },
@@ -474,7 +466,7 @@ - (void)testGetCollectionWhileOfflineWithDifferentGetOptions {
474
466
475
467
// attempt to get docs (from the server) and ensure they cannot be retreived
476
468
XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription: @" failedGetDocs" ];
477
- [col getDocumentsWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceServer]
469
+ [col getDocumentsWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceServer]
478
470
completion: ^(FIRQuerySnapshot *snapshot, NSError *error) {
479
471
XCTAssertNotNil (error);
480
472
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
@@ -547,7 +539,7 @@ - (void)testGetNonExistingDocWhileOnlineCacheOnly {
547
539
// certain documents *don't* exist.
548
540
XCTestExpectation *getNonExistingDocCompletion =
549
541
[self expectationWithDescription: @" getNonExistingDoc" ];
550
- [doc getDocumentWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceCache]
542
+ [doc getDocumentWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceCache]
551
543
completion: ^(FIRDocumentSnapshot *snapshot, NSError *error) {
552
544
XCTAssertNotNil (error);
553
545
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
@@ -562,8 +554,7 @@ - (void)testGetNonExistingCollectionWhileOnlineCacheOnly {
562
554
563
555
// get collection and ensure it's empty and that it *is* from the cache.
564
556
FIRQuerySnapshot *snapshot =
565
- [self readDocumentSetForRef: col
566
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
557
+ [self readDocumentSetForRef: col options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
567
558
XCTAssertEqual (snapshot.count , 0 );
568
559
XCTAssertEqual (snapshot.documentChanges .count , 0 );
569
560
XCTAssertTrue (snapshot.metadata .fromCache );
@@ -581,7 +572,7 @@ - (void)testGetNonExistingDocWhileOfflineCacheOnly {
581
572
// certain documents *don't* exist.
582
573
XCTestExpectation *getNonExistingDocCompletion =
583
574
[self expectationWithDescription: @" getNonExistingDoc" ];
584
- [doc getDocumentWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceCache]
575
+ [doc getDocumentWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceCache]
585
576
completion: ^(FIRDocumentSnapshot *snapshot, NSError *error) {
586
577
XCTAssertNotNil (error);
587
578
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
@@ -599,8 +590,7 @@ - (void)testGetNonExistingCollectionWhileOfflineCacheOnly {
599
590
600
591
// get collection and ensure it's empty and that it *is* from the cache.
601
592
FIRQuerySnapshot *snapshot =
602
- [self readDocumentSetForRef: col
603
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceCache]];
593
+ [self readDocumentSetForRef: col options: [FIRGetOptions optionsWithSource: FIRGetSourceCache]];
604
594
XCTAssertEqual (snapshot.count , 0 );
605
595
XCTAssertEqual (snapshot.documentChanges .count , 0 );
606
596
XCTAssertTrue (snapshot.metadata .fromCache );
@@ -612,8 +602,7 @@ - (void)testGetNonExistingDocWhileOnlineServerOnly {
612
602
613
603
// get doc and ensure that it does not exist and is *not* from the cache.
614
604
FIRDocumentSnapshot *snapshot =
615
- [self readDocumentForRef: doc
616
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceServer]];
605
+ [self readDocumentForRef: doc options: [FIRGetOptions optionsWithSource: FIRGetSourceServer]];
617
606
XCTAssertFalse (snapshot.exists );
618
607
XCTAssertFalse (snapshot.metadata .fromCache );
619
608
XCTAssertFalse (snapshot.metadata .hasPendingWrites );
@@ -624,8 +613,7 @@ - (void)testGetNonExistingCollectionWhileOnlineServerOnly {
624
613
625
614
// get collection and ensure that it's empty and that it's *not* from the cache.
626
615
FIRQuerySnapshot *snapshot =
627
- [self readDocumentSetForRef: col
628
- options: [[FIRGetOptions alloc ] initWithSource: FIRGetSourceServer]];
616
+ [self readDocumentSetForRef: col options: [FIRGetOptions optionsWithSource: FIRGetSourceServer]];
629
617
XCTAssertEqual (snapshot.count , 0 );
630
618
XCTAssertEqual (snapshot.documentChanges .count , 0 );
631
619
XCTAssertFalse (snapshot.metadata .fromCache );
@@ -643,7 +631,7 @@ - (void)testGetNonExistingDocWhileOfflineServerOnly {
643
631
// certain documents *don't* exist.
644
632
XCTestExpectation *getNonExistingDocCompletion =
645
633
[self expectationWithDescription: @" getNonExistingDoc" ];
646
- [doc getDocumentWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceServer]
634
+ [doc getDocumentWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceServer]
647
635
completion: ^(FIRDocumentSnapshot *snapshot, NSError *error) {
648
636
XCTAssertNotNil (error);
649
637
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
@@ -661,7 +649,7 @@ - (void)testGetNonExistingCollectionWhileOfflineServerOnly {
661
649
662
650
// attempt to get collection and ensure that it cannot be retreived
663
651
XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription: @" failedGetDocs" ];
664
- [col getDocumentsWithOptions: [[ FIRGetOptions alloc ] initWithSource : FIRGetSourceServer]
652
+ [col getDocumentsWithOptions: [FIRGetOptions optionsWithSource : FIRGetSourceServer]
665
653
completion: ^(FIRQuerySnapshot *snapshot, NSError *error) {
666
654
XCTAssertNotNil (error);
667
655
XCTAssertEqualObjects (error.domain , FIRFirestoreErrorDomain);
0 commit comments