diff options
Diffstat (limited to 'Firestore/Example/Tests/Model/FSTPathTests.mm')
-rw-r--r-- | Firestore/Example/Tests/Model/FSTPathTests.mm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Firestore/Example/Tests/Model/FSTPathTests.mm b/Firestore/Example/Tests/Model/FSTPathTests.mm index 68bcc44..388c5c3 100644 --- a/Firestore/Example/Tests/Model/FSTPathTests.mm +++ b/Firestore/Example/Tests/Model/FSTPathTests.mm @@ -195,6 +195,30 @@ NS_ASSUME_NONNULL_BEGIN XCTAssertEqualObjects([[pathHead pathByRemovingFirstSegment] canonicalString], @"bar"); } +- (void)testRoundTrip { + FSTFieldPath *path = [FSTFieldPath pathWithSegments:@[ @"rooms", @"Eros", @"messages" ]]; + XCTAssertEqualObjects(path, [FSTFieldPath fieldPathWithCPPFieldPath:[path toCPPFieldPath]]); + + const firebase::firestore::model::FieldPath cppPath{"rooms", "Eros", "messages"}; + XCTAssertEqual(cppPath, [[FSTFieldPath fieldPathWithCPPFieldPath:cppPath] toCPPFieldPath]); +} + +@end + +@interface FSTResourcePathTests : XCTestCase @end +@implementation FSTResourcePathTests + +- (void)testRoundTrip { + FSTResourcePath *path = [FSTResourcePath pathWithSegments:@[ @"rooms", @"Eros", @"messages" ]]; + XCTAssertEqualObjects(path, + [FSTResourcePath resourcePathWithCPPResourcePath:[path toCPPResourcePath]]); + + const firebase::firestore::model::ResourcePath cppPath{"rooms", "Eros", "messages"}; + XCTAssertEqual(cppPath, + [[FSTResourcePath resourcePathWithCPPResourcePath:cppPath] toCPPResourcePath]); +} + +@end NS_ASSUME_NONNULL_END |