diff options
author | zxu <zxu@google.com> | 2018-03-16 15:42:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-16 15:42:05 -0400 |
commit | 4e7296b080b9c8cea13e5e5eeee65f4312fb5e8a (patch) | |
tree | 87f175b1e1ac74632fee2ff7c52ccb9b5bc78014 /Firestore/Example/Tests/Model/FSTDocumentTests.mm | |
parent | 1395c8202b236188b9e4e1bfc2a3e00244179593 (diff) |
port `DocumentKey` to non-container types of `Model/*` (#930)
* naively remove FSTPath import and source/test files.
* port FieldPath, part I
* port FieldPath, part II
* port ResourcePath, part I
* port ResourcePath, part II
* the grand commit to fix build errors
* use testutil:: helper instead of those from FSTHelpers
* fix test and lint
* use c_str in errmsg directly
* fix
* fix
* make code clean
* fix integration test I missed
* fix to avoid naming collision in preprocessor
* address changes
* address changes
* address changes
* fix: fieldMask are actually shared with different context.
* address changes
* add converter function between two DocumentKey implementations
* add unit test
* address changes
* fix lint
* using DocumentKey in model except for the container types `FSTDocumentDictionary`, `FSTDocumentKeySet`, and `FSTDocumentVersionDictionary`
* change other place w.r.t. the use of `DocumentKey` in model
* update parameter of test helpers from NSString to string_view
* revert a temporary change used in debug
* address changes
Diffstat (limited to 'Firestore/Example/Tests/Model/FSTDocumentTests.mm')
-rw-r--r-- | Firestore/Example/Tests/Model/FSTDocumentTests.mm | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Firestore/Example/Tests/Model/FSTDocumentTests.mm b/Firestore/Example/Tests/Model/FSTDocumentTests.mm index 0527852..24858c5 100644 --- a/Firestore/Example/Tests/Model/FSTDocumentTests.mm +++ b/Firestore/Example/Tests/Model/FSTDocumentTests.mm @@ -19,14 +19,15 @@ #import <XCTest/XCTest.h> #import "Firestore/Source/Core/FSTSnapshotVersion.h" -#import "Firestore/Source/Model/FSTDocumentKey.h" #import "Firestore/Source/Model/FSTFieldValue.h" #import "Firestore/Example/Tests/Util/FSTHelpers.h" +#include "Firestore/core/src/firebase/firestore/model/document_key.h" #include "Firestore/core/test/firebase/firestore/testutil/testutil.h" namespace testutil = firebase::firestore::testutil; +using firebase::firestore::model::DocumentKey; NS_ASSUME_NONNULL_BEGIN @@ -36,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation FSTDocumentTests - (void)testConstructor { - FSTDocumentKey *key = FSTTestDocKey(@"messages/first"); + DocumentKey key = testutil::Key("messages/first"); FSTSnapshotVersion *version = FSTTestVersion(1); FSTObjectValue *data = FSTTestObjectValue(@{ @"a" : @1 }); FSTDocument *doc = @@ -49,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN } - (void)testExtractsFields { - FSTDocumentKey *key = FSTTestDocKey(@"rooms/eros"); + DocumentKey key = testutil::Key("rooms/eros"); FSTSnapshotVersion *version = FSTTestVersion(1); FSTObjectValue *data = FSTTestObjectValue(@{ @"desc" : @"Discuss all the project related stuff", @@ -65,30 +66,30 @@ NS_ASSUME_NONNULL_BEGIN } - (void)testIsEqual { - XCTAssertEqualObjects(FSTTestDoc(@"messages/first", 1, + XCTAssertEqualObjects(FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, NO), - FSTTestDoc(@"messages/first", 1, + FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, NO)); - XCTAssertNotEqualObjects(FSTTestDoc(@"messages/first", 1, + XCTAssertNotEqualObjects(FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, NO), - FSTTestDoc(@"messages/first", 1, + FSTTestDoc("messages/first", 1, @{ @"b" : @1 }, NO)); - XCTAssertNotEqualObjects(FSTTestDoc(@"messages/first", 1, + XCTAssertNotEqualObjects(FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, NO), - FSTTestDoc(@"messages/second", 1, + FSTTestDoc("messages/second", 1, @{ @"b" : @1 }, NO)); - XCTAssertNotEqualObjects(FSTTestDoc(@"messages/first", 1, + XCTAssertNotEqualObjects(FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, NO), - FSTTestDoc(@"messages/first", 2, + FSTTestDoc("messages/first", 2, @{ @"a" : @1 }, NO)); - XCTAssertNotEqualObjects(FSTTestDoc(@"messages/first", 1, + XCTAssertNotEqualObjects(FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, NO), - FSTTestDoc(@"messages/first", 1, + FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, YES)); - XCTAssertEqualObjects(FSTTestDoc(@"messages/first", 1, + XCTAssertEqualObjects(FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, YES), - FSTTestDoc(@"messages/first", 1, + FSTTestDoc("messages/first", 1, @{ @"a" : @1 }, 5)); } |