@@ -110,11 +110,18 @@ - (void)testNilCollectionPathsFail {
110
110
FSTAssertThrows ([baseDocRef collectionWithPath: nil ], nilError);
111
111
}
112
112
113
+ - (void )testEmptyCollectionPathsFail {
114
+ FIRDocumentReference *baseDocRef = [self .db documentWithPath: @" foo/bar" ];
115
+ NSString *emptyError = @" Collection path cannot be empty." ;
116
+ FSTAssertThrows ([self .db collectionWithPath: @" " ], emptyError);
117
+ FSTAssertThrows ([baseDocRef collectionWithPath: @" " ], emptyError);
118
+ }
119
+
113
120
- (void )testWrongLengthCollectionPathsFail {
114
121
FIRDocumentReference *baseDocRef = [self .db documentWithPath: @" foo/bar" ];
115
- NSArray *badAbsolutePaths = @[ @" foo/bar" , @" foo/bar/baz/quu" ];
116
- NSArray *badRelativePaths = @[ @" " , @" baz/quu" ];
117
- NSArray *badPathLengths = @[ @2 , @4 ];
122
+ NSArray *badAbsolutePaths = @[ @" foo/bar/baz/quu " , @" foo/bar/baz/quu/x/y " ];
123
+ NSArray *badRelativePaths = @[ @" baz/quu " , @" baz/quu/x/y " ];
124
+ NSArray *badPathLengths = @[ @4 , @6 ];
118
125
NSString *errorFormat = @" Invalid collection reference. Collection references must have an odd "
119
126
@" number of segments, but %@ has %@ " ;
120
127
for (NSUInteger i = 0 ; i < badAbsolutePaths.count ; i++) {
@@ -125,18 +132,35 @@ - (void)testWrongLengthCollectionPathsFail {
125
132
}
126
133
}
127
134
135
+ - (void )testNilCollectionGroupPathsFail {
136
+ NSString *nilError = @" Collection ID cannot be nil." ;
137
+ FSTAssertThrows ([self .db collectionGroupWithID: nil ], nilError);
138
+ }
139
+
140
+ - (void )testEmptyCollectionGroupPathsFail {
141
+ NSString *emptyError = @" Collection ID cannot be empty." ;
142
+ FSTAssertThrows ([self .db collectionGroupWithID: @" " ], emptyError);
143
+ }
144
+
128
145
- (void )testNilDocumentPathsFail {
129
146
FIRCollectionReference *baseCollectionRef = [self .db collectionWithPath: @" foo" ];
130
147
NSString *nilError = @" Document path cannot be nil." ;
131
148
FSTAssertThrows ([self .db documentWithPath: nil ], nilError);
132
149
FSTAssertThrows ([baseCollectionRef documentWithPath: nil ], nilError);
133
150
}
134
151
152
+ - (void )testEmptyDocumentPathsFail {
153
+ FIRCollectionReference *baseCollectionRef = [self .db collectionWithPath: @" foo" ];
154
+ NSString *emptyError = @" Document path cannot be empty." ;
155
+ FSTAssertThrows ([self .db documentWithPath: @" " ], emptyError);
156
+ FSTAssertThrows ([baseCollectionRef documentWithPath: @" " ], emptyError);
157
+ }
158
+
135
159
- (void )testWrongLengthDocumentPathsFail {
136
160
FIRCollectionReference *baseCollectionRef = [self .db collectionWithPath: @" foo" ];
137
- NSArray *badAbsolutePaths = @[ @" foo" , @" foo/bar/baz" ];
138
- NSArray *badRelativePaths = @[ @" " , @" bar/baz" ];
139
- NSArray *badPathLengths = @[ @1 , @3 ];
161
+ NSArray *badAbsolutePaths = @[ @" foo/bar/baz " , @" foo/bar/baz/x/y " ];
162
+ NSArray *badRelativePaths = @[ @" bar/baz " , @" bar/baz/x/y " ];
163
+ NSArray *badPathLengths = @[ @3 , @5 ];
140
164
NSString *errorFormat = @" Invalid document reference. Document references must have an even "
141
165
@" number of segments, but %@ has %@ " ;
142
166
for (NSUInteger i = 0 ; i < badAbsolutePaths.count ; i++) {
0 commit comments