|
23 | 23 | #import "FBLPromises.h"
|
24 | 24 | #endif
|
25 | 25 |
|
| 26 | +#import "FBLPromise+Testing.h" |
| 27 | + |
26 | 28 | #include "Crashlytics/Crashlytics/Components/FIRCLSContext.h"
|
27 | 29 | #include "Crashlytics/Crashlytics/Components/FIRCLSCrashedMarkerFile.h"
|
28 | 30 | #import "Crashlytics/Crashlytics/Controllers/FIRCLSAnalyticsManager.h"
|
@@ -201,17 +203,10 @@ - (NSArray *)uploadReportArray {
|
201 | 203 | #pragma mark - File/Directory Handling
|
202 | 204 | - (void)testCreatesNewReportOnStart {
|
203 | 205 | FBLPromise<NSNumber *> *promise = [self->_reportManager startWithProfiling];
|
| 206 | + FBLWaitForPromisesWithTimeout(1.0); |
204 | 207 |
|
205 |
| - XCTestExpectation *expectation = |
206 |
| - [[XCTestExpectation alloc] initWithDescription:@"waiting on promise"]; |
207 |
| - [promise then:^id _Nullable(NSNumber *_Nullable value) { |
208 |
| - XCTAssertTrue([value boolValue]); |
209 |
| - XCTAssertEqual([[self contentsOfActivePath] count], 1); |
210 |
| - [expectation fulfill]; |
211 |
| - return value; |
212 |
| - }]; |
213 |
| - |
214 |
| - [self waitForExpectations:@[ expectation ] timeout:1.0]; |
| 208 | + XCTAssertTrue([promise.value boolValue]); |
| 209 | + XCTAssertEqual([[self contentsOfActivePath] count], 1); |
215 | 210 | }
|
216 | 211 |
|
217 | 212 | - (void)waitForPromise:(FBLPromise<NSNumber *> *)promise {
|
@@ -314,10 +309,11 @@ - (void)testMetricKitResolvesPromiseIfNoDiagnostics {
|
314 | 309 |
|
315 | 310 | - (void)testExistingUnimportantReportOnStartWithDataCollectionDisabled {
|
316 | 311 | // create a report and put it in place
|
317 |
| - [self createActiveReport]; |
| 312 | + XCTAssertNotNil([self createActiveReport]); |
318 | 313 |
|
319 | 314 | // Starting with data collection disabled should report in nothing changing
|
320 | 315 | [self startReportManagerWithDataCollectionEnabled:NO];
|
| 316 | + FBLWaitForPromisesWithTimeout(1.0); |
321 | 317 |
|
322 | 318 | XCTAssertEqual([[self contentsOfActivePath] count], 1);
|
323 | 319 |
|
|
0 commit comments