18
18
19
19
#import < XCTest/XCTest.h>
20
20
21
+ #import " Firestore/Example/Tests/Util/FSTHelpers.h"
21
22
#import " Firestore/Example/Tests/Util/FSTIntegrationTestCase.h"
22
23
#import " Firestore/Source/API/FIRFirestore+Internal.h"
23
24
#import " Firestore/Source/Core/FSTFirestoreClient.h"
@@ -62,11 +63,18 @@ - (void)testGetCollectionWhileOnlineWithDefaultGetOptions {
62
63
XCTAssertEqualObjects (
63
64
FIRQuerySnapshotGetData (result),
64
65
(@[ @{@" key1" : @" value1" }, @{@" key2" : @" value2" }, @{@" key3" : @" value3" } ]));
65
- XCTAssertEqualObjects (FIRQuerySnapshotGetDocChangesData (result), (@[
66
- @[ @(FIRDocumentChangeTypeAdded), @" doc1" , @{@" key1" : @" value1" } ],
67
- @[ @(FIRDocumentChangeTypeAdded), @" doc2" , @{@" key2" : @" value2" } ],
68
- @[ @(FIRDocumentChangeTypeAdded), @" doc3" , @{@" key3" : @" value3" } ]
69
- ]));
66
+ XCTAssertEqualObjects (
67
+ FIRQuerySnapshotGetDocChangesData (result), (@[
68
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
69
+ name: @" doc1"
70
+ data: @{@" key1" : @" value1" }],
71
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
72
+ name: @" doc2"
73
+ data: @{@" key2" : @" value2" }],
74
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
75
+ name: @" doc3"
76
+ data: @{@" key3" : @" value3" }]
77
+ ]));
70
78
}
71
79
72
80
- (void )testGetDocumentWhileOfflineWithDefaultGetOptions {
@@ -128,10 +136,19 @@ - (void)testGetCollectionWhileOfflineWithDefaultGetOptions {
128
136
]));
129
137
XCTAssertEqualObjects (
130
138
FIRQuerySnapshotGetDocChangesData (result), (@[
131
- @[ @(FIRDocumentChangeTypeAdded), @" doc1" , @{@" key1" : @" value1" } ],
132
- @[ @(FIRDocumentChangeTypeAdded), @" doc2" , @{@" key2" : @" value2" , @" key2b" : @" value2b" } ],
133
- @[ @(FIRDocumentChangeTypeAdded), @" doc3" , @{@" key3b" : @" value3b" } ],
134
- @[ @(FIRDocumentChangeTypeAdded), @" doc4" , @{@" key4" : @" value4" } ]
139
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
140
+ name: @" doc1"
141
+ data: @{@" key1" : @" value1" }],
142
+ [[FSTTestDocumentChange alloc ]
143
+ initWithChangeType: FIRDocumentChangeTypeAdded
144
+ name: @" doc2"
145
+ data: @{@" key2" : @" value2" , @" key2b" : @" value2b" }],
146
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
147
+ name: @" doc3"
148
+ data: @{@" key3b" : @" value3b" }],
149
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
150
+ name: @" doc4"
151
+ data: @{@" key4" : @" value4" }]
135
152
]));
136
153
}
137
154
@@ -176,11 +193,18 @@ - (void)testGetCollectionWhileOnlineCacheOnly {
176
193
@{@" key2" : @" value2" },
177
194
@{@" key3" : @" value3" },
178
195
]));
179
- XCTAssertEqualObjects (FIRQuerySnapshotGetDocChangesData (result), (@[
180
- @[ @(FIRDocumentChangeTypeAdded), @" doc1" , @{@" key1" : @" value1" } ],
181
- @[ @(FIRDocumentChangeTypeAdded), @" doc2" , @{@" key2" : @" value2" } ],
182
- @[ @(FIRDocumentChangeTypeAdded), @" doc3" , @{@" key3" : @" value3" } ]
183
- ]));
196
+ XCTAssertEqualObjects (
197
+ FIRQuerySnapshotGetDocChangesData (result), (@[
198
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
199
+ name: @" doc1"
200
+ data: @{@" key1" : @" value1" }],
201
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
202
+ name: @" doc2"
203
+ data: @{@" key2" : @" value2" }],
204
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
205
+ name: @" doc3"
206
+ data: @{@" key3" : @" value3" }]
207
+ ]));
184
208
}
185
209
186
210
- (void )testGetDocumentWhileOfflineCacheOnly {
@@ -247,10 +271,19 @@ - (void)testGetCollectionWhileOfflineCacheOnly {
247
271
]));
248
272
XCTAssertEqualObjects (
249
273
FIRQuerySnapshotGetDocChangesData (result), (@[
250
- @[ @(FIRDocumentChangeTypeAdded), @" doc1" , @{@" key1" : @" value1" } ],
251
- @[ @(FIRDocumentChangeTypeAdded), @" doc2" , @{@" key2" : @" value2" , @" key2b" : @" value2b" } ],
252
- @[ @(FIRDocumentChangeTypeAdded), @" doc3" , @{@" key3b" : @" value3b" } ],
253
- @[ @(FIRDocumentChangeTypeAdded), @" doc4" , @{@" key4" : @" value4" } ]
274
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
275
+ name: @" doc1"
276
+ data: @{@" key1" : @" value1" }],
277
+ [[FSTTestDocumentChange alloc ]
278
+ initWithChangeType: FIRDocumentChangeTypeAdded
279
+ name: @" doc2"
280
+ data: @{@" key2" : @" value2" , @" key2b" : @" value2b" }],
281
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
282
+ name: @" doc3"
283
+ data: @{@" key3b" : @" value3b" }],
284
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
285
+ name: @" doc4"
286
+ data: @{@" key4" : @" value4" }]
254
287
]));
255
288
}
256
289
@@ -295,11 +328,18 @@ - (void)testGetCollectionWhileOnlineServerOnly {
295
328
@{@" key2" : @" value2" },
296
329
@{@" key3" : @" value3" },
297
330
]));
298
- XCTAssertEqualObjects (FIRQuerySnapshotGetDocChangesData (result), (@[
299
- @[ @(FIRDocumentChangeTypeAdded), @" doc1" , @{@" key1" : @" value1" } ],
300
- @[ @(FIRDocumentChangeTypeAdded), @" doc2" , @{@" key2" : @" value2" } ],
301
- @[ @(FIRDocumentChangeTypeAdded), @" doc3" , @{@" key3" : @" value3" } ]
302
- ]));
331
+ XCTAssertEqualObjects (
332
+ FIRQuerySnapshotGetDocChangesData (result), (@[
333
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
334
+ name: @" doc1"
335
+ data: @{@" key1" : @" value1" }],
336
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
337
+ name: @" doc2"
338
+ data: @{@" key2" : @" value2" }],
339
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
340
+ name: @" doc3"
341
+ data: @{@" key3" : @" value3" }]
342
+ ]));
303
343
}
304
344
305
345
- (void )testGetDocumentWhileOfflineServerOnly {
@@ -450,10 +490,19 @@ - (void)testGetCollectionWhileOfflineWithDifferentGetOptions {
450
490
]));
451
491
XCTAssertEqualObjects (
452
492
FIRQuerySnapshotGetDocChangesData (result), (@[
453
- @[ @(FIRDocumentChangeTypeAdded), @" doc1" , @{@" key1" : @" value1" } ],
454
- @[ @(FIRDocumentChangeTypeAdded), @" doc2" , @{@" key2" : @" value2" , @" key2b" : @" value2b" } ],
455
- @[ @(FIRDocumentChangeTypeAdded), @" doc3" , @{@" key3b" : @" value3b" } ],
456
- @[ @(FIRDocumentChangeTypeAdded), @" doc4" , @{@" key4" : @" value4" } ]
493
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
494
+ name: @" doc1"
495
+ data: @{@" key1" : @" value1" }],
496
+ [[FSTTestDocumentChange alloc ]
497
+ initWithChangeType: FIRDocumentChangeTypeAdded
498
+ name: @" doc2"
499
+ data: @{@" key2" : @" value2" , @" key2b" : @" value2b" }],
500
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
501
+ name: @" doc3"
502
+ data: @{@" key3b" : @" value3b" }],
503
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
504
+ name: @" doc4"
505
+ data: @{@" key4" : @" value4" }]
457
506
]));
458
507
459
508
// attempt to get docs (with default get options)
@@ -466,10 +515,19 @@ - (void)testGetCollectionWhileOfflineWithDifferentGetOptions {
466
515
]));
467
516
XCTAssertEqualObjects (
468
517
FIRQuerySnapshotGetDocChangesData (result), (@[
469
- @[ @(FIRDocumentChangeTypeAdded), @" doc1" , @{@" key1" : @" value1" } ],
470
- @[ @(FIRDocumentChangeTypeAdded), @" doc2" , @{@" key2" : @" value2" , @" key2b" : @" value2b" } ],
471
- @[ @(FIRDocumentChangeTypeAdded), @" doc3" , @{@" key3b" : @" value3b" } ],
472
- @[ @(FIRDocumentChangeTypeAdded), @" doc4" , @{@" key4" : @" value4" } ]
518
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
519
+ name: @" doc1"
520
+ data: @{@" key1" : @" value1" }],
521
+ [[FSTTestDocumentChange alloc ]
522
+ initWithChangeType: FIRDocumentChangeTypeAdded
523
+ name: @" doc2"
524
+ data: @{@" key2" : @" value2" , @" key2b" : @" value2b" }],
525
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
526
+ name: @" doc3"
527
+ data: @{@" key3b" : @" value3b" }],
528
+ [[FSTTestDocumentChange alloc ] initWithChangeType: FIRDocumentChangeTypeAdded
529
+ name: @" doc4"
530
+ data: @{@" key4" : @" value4" }]
473
531
]));
474
532
475
533
// attempt to get docs (from the server) and ensure they cannot be retreived
0 commit comments