Skip to content

Commit fb0fb9f

Browse files
committed
check datafile was saved in the completion block
1 parent 08a4d1c commit fb0fb9f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

OptimizelySDKDatafileManager/OptimizelySDKDatafileManagerTests/OPTLYDatafileManagerTest.m

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,15 @@ - (void)testDatafileManagerDownloadDatafileSavesDatafile {
170170
}];
171171

172172
// Call download datafile
173-
__block Boolean completionWasCalled = false;
174173

175174
[datafileManager downloadDatafile:datafileManager.projectId
176175
completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
177-
completionWasCalled = true;
176+
XCTAssertTrue([self.dataStore fileExists:kProjectId type:OPTLYDataStoreDataTypeDatafile], @"we should have stored the datafile");
178177
[expectation fulfill];
179178
}];
180179

181180
// make sure we were able to save the datafile
182-
[self waitForExpectationsWithTimeout:2 handler:nil];
183-
XCTAssertTrue(completionWasCalled);
184-
XCTAssertTrue([self.dataStore fileExists:kProjectId type:OPTLYDataStoreDataTypeDatafile], @"we should have stored the datafile");
185-
181+
[self waitForExpectationsWithTimeout:2 handler:nil];
186182
// cleanup stubs
187183
[OHHTTPStubs removeStub:stub];
188184
}

0 commit comments

Comments
 (0)