@@ -79,6 +79,29 @@ - (void)testValidatesInput {
79
79
[FIRStorageTestHelpers waitForExpectation: self ];
80
80
}
81
81
82
+ - (void )testListAllCallbackOnlyCalledOnce {
83
+ XCTestExpectation *expectation =
84
+ [self expectationWithDescription: @" testListAllCallbackOnlyCalledOnce" ];
85
+ expectation.expectedFulfillmentCount = 1 ;
86
+
87
+ FIRStoragePath *path = [FIRStorageTestHelpers objectPath ];
88
+ FIRStorageReference *ref = [[FIRStorageReference alloc ] initWithStorage: self .storage path: path];
89
+
90
+ FIRStorageVoidListError errorBlock = ^(FIRStorageListResult *result, NSError *error) {
91
+ XCTAssertNil (result);
92
+ XCTAssertNotNil (error);
93
+
94
+ XCTAssertEqualObjects (error.domain , @" FIRStorageErrorDomain" );
95
+ XCTAssertEqual (error.code , FIRStorageErrorCodeUnknown);
96
+
97
+ [expectation fulfill ];
98
+ };
99
+
100
+ [ref listAllWithCompletion: errorBlock];
101
+
102
+ [FIRStorageTestHelpers waitForExpectation: self ];
103
+ }
104
+
82
105
- (void )testDefaultList {
83
106
XCTestExpectation *expectation = [self expectationWithDescription: @" testDefaultList" ];
84
107
NSURL *expectedURL = [NSURL
@@ -251,7 +274,7 @@ - (void)testListWithResponse {
251
274
- (void )testListWithErrorResponse {
252
275
XCTestExpectation *expectation = [self expectationWithDescription: @" testListWithErrorResponse" ];
253
276
254
- NSError *error = [NSError errorWithDomain: @" com.google.firebase.storage" code: - 1 userInfo: nil ];
277
+ NSError *error = [NSError errorWithDomain: @" com.google.firebase.storage" code: 404 userInfo: nil ];
255
278
256
279
self.fetcherService .testBlock =
257
280
^(GTMSessionFetcher *fetcher, GTMSessionFetcherTestResponse response) {
@@ -276,6 +299,7 @@ - (void)testListWithErrorResponse {
276
299
XCTAssertNil (result);
277
300
278
301
XCTAssertEqualObjects (error.domain , @" FIRStorageErrorDomain" );
302
+ XCTAssertEqual (error.code , FIRStorageErrorCodeObjectNotFound);
279
303
280
304
[expectation fulfill ];
281
305
}];
0 commit comments