diff options
author | zxu <zxu@google.com> | 2017-12-19 13:47:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 13:47:04 -0500 |
commit | 9ddf3637ac984abfe16d4ebef6ff3947b4e946c1 (patch) | |
tree | 008d6eea9adc10675c79c7152703f4fd05af4cf9 /Firestore/Example/Tests/SpecTests | |
parent | 52cdf0b25a12b5baed8546893634dab9c1a03e56 (diff) |
Firestore `isEqual()` on Public Types (#569)
* add bone code for new isEqual and unit test for old isEqual
* add bone code for `FIRCollectionReference`, `FIRDocumentSnapshot`, `FIRFieldValue`, `FIRQuerySnapshot`, `FIRSnapshotMetadata`;
* change inconsistenciness of `FIRFieldPath.isEqual` implementation;
* add unit test (and file) for `FIRDocumentReferenceTest.m`, `FIRFieldPathTest.m`, `FIRQueryTests.testEquals`; `FIRGeoPoint` already has test and Blob is internal type.
* Implement isEqual for FIRCollectionReference
adding the working code and unit test.
* implement isEqual for FIRSnapshotMetadata
* Implement isEqual for FIRDocumentSnapshot
* Implement isEqual for FIRQuerySnapshot
* (un)implement `isEqual` for `FIRFieldValue`
Since `FIRFieldValue` both types are singleton, we do not need override `isEqual`. Add test to test the default `NSObject` `isEqual` works just fine.
* fix style with `scripts/style.sh`
* Implement hash for those with overridden isEqual without hash yet.
* refactor to use test helper functions -- FSTTestFirestore, FSTTestPath, FSTTestDocKey
* refactor using test helper `FSTTestDocSnapshot`, `FSTTestFieldPath`, `FSTTestQuery`, `FSTTestDoc`
* refactoring to use test helper method `FSTTestQuerySnapshot`,
* remove unneccessary nil-check, check isKindOfClass instead of isEqual
* refactoring: adding `FSTAPIHelpers.{h,m}`, `FSTTest{Collection,Document}Ref`, better naming and style fix
* a file forgot in last commit
* mainly clean up import and some minor refactoring
* fix style via style.sh
* minor style fix
* add pragma ignored -Wnonnull
Diffstat (limited to 'Firestore/Example/Tests/SpecTests')
-rw-r--r-- | Firestore/Example/Tests/SpecTests/FSTSpecTests.m | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Firestore/Example/Tests/SpecTests/FSTSpecTests.m b/Firestore/Example/Tests/SpecTests/FSTSpecTests.m index 0bd7b43..3abcb48 100644 --- a/Firestore/Example/Tests/SpecTests/FSTSpecTests.m +++ b/Firestore/Example/Tests/SpecTests/FSTSpecTests.m @@ -103,11 +103,11 @@ static NSString *const kNoIOSTag = @"no-ios"; - (nullable FSTQuery *)parseQuery:(id)querySpec { if ([querySpec isKindOfClass:[NSString class]]) { - return [FSTQuery queryWithPath:[FSTResourcePath pathWithString:querySpec]]; + return FSTTestQuery(querySpec); } else if ([querySpec isKindOfClass:[NSDictionary class]]) { NSDictionary *queryDict = (NSDictionary *)querySpec; NSString *path = queryDict[@"path"]; - __block FSTQuery *query = [FSTQuery queryWithPath:[FSTResourcePath pathWithString:path]]; + __block FSTQuery *query = FSTTestQuery(path); if (queryDict[@"limit"]) { NSNumber *limit = queryDict[@"limit"]; query = [query queryBySettingLimit:limit.integerValue]; @@ -237,7 +237,7 @@ static NSString *const kNoIOSTag = @"no-ios"; } } else if (watchEntity[@"doc"]) { NSArray *docSpec = watchEntity[@"doc"]; - FSTDocumentKey *key = [FSTDocumentKey keyWithPathString:docSpec[0]]; + FSTDocumentKey *key = FSTTestDocKey(docSpec[0]); FSTObjectValue *value = FSTTestObjectValue(docSpec[2]); FSTSnapshotVersion *version = [self parseVersion:docSpec[1]]; FSTMaybeDocument *doc = @@ -249,7 +249,7 @@ static NSString *const kNoIOSTag = @"no-ios"; document:doc]; [self.driver receiveWatchChange:change snapshotVersion:[self parseVersion:watchSnapshot]]; } else if (watchEntity[@"key"]) { - FSTDocumentKey *docKey = [FSTDocumentKey keyWithPathString:watchEntity[@"key"]]; + FSTDocumentKey *docKey = FSTTestDocKey(watchEntity[@"key"]); FSTWatchChange *change = [[FSTDocumentWatchChange alloc] initWithUpdatedTargetIDs:@[] removedTargetIDs:watchEntity[@"removedTargets"] |