Skip to content

Commit af2c46e

Browse files
committed
clean up the datafile manager tests a little bit
1 parent 587fc1a commit af2c46e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

OptimizelySDKDatafileManager/OptimizelySDKDatafileManager/OPTLYDatafileManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ - (NSData *)getSavedDatafile {
129129
NSData *datafile = [self.dataStore getFile:self.projectId
130130
type:OPTLYDataStoreDataTypeDatafile
131131
error:&error];
132-
if (error != nil ) {
132+
if (error != nil) {
133133
[self.errorHandler handleError:error];
134134
}
135135
return datafile;

OptimizelySDKDatafileManager/OptimizelySDKDatafileManagerTests/OPTLYDatafileManagerTest.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
static NSTimeInterval kDatafileDownloadInteval = 5; // in seconds
2727
static NSString *const kLastModifiedDate = @"Mon, 28 Nov 2016 06:10:59 GMT";
2828
static NSData *kDatafileData;
29+
static NSDictionary *const kCDNResponseHeaders =@{@"Content-Type":@"application/json",
30+
@"Last-Modified":kLastModifiedDate};
2931

3032
@interface OPTLYDatafileManager(test)
3133
@property (nonatomic, strong) NSTimer *datafileDownloadTimer;
@@ -148,6 +150,8 @@ - (void)testDatafileManagerDownloadDatafileSavesDatafile {
148150

149151
// make sure we were able to save the datafile
150152
[self waitForExpectationsWithTimeout:2 handler:nil];
153+
154+
// clean up stub
151155
[OHHTTPStubs removeStub:stub];
152156
}
153157

@@ -242,8 +246,7 @@ - (void)test304Response
242246
} withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
243247
return [OHHTTPStubsResponse responseWithData:kDatafileData
244248
statusCode:200
245-
headers:@{@"Content-Type":@"application/json",
246-
@"Last-Modified":kLastModifiedDate}];
249+
headers:kCDNResponseHeaders];
247250
}];
248251
}
249252

@@ -258,14 +261,12 @@ - (void)test304Response
258261
if ([request.allHTTPHeaderFields objectForKey:@"If-Modified-Since"] != nil) {
259262
return [OHHTTPStubsResponse responseWithData:nil
260263
statusCode:304
261-
headers:@{@"Content-Type":@"application/json",
262-
@"Last-Modified":kLastModifiedDate}];
264+
headers:kCDNResponseHeaders];
263265
}
264266
else {
265267
return [OHHTTPStubsResponse responseWithData:kDatafileData
266268
statusCode:200
267-
headers:@{@"Content-Type":@"application/json",
268-
@"Last-Modified":kLastModifiedDate}];
269+
headers:kCDNResponseHeaders];
269270

270271
}
271272
}];
@@ -281,8 +282,7 @@ - (void)test304Response
281282
} withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
282283
return [OHHTTPStubsResponse responseWithData:nil
283284
statusCode:400
284-
headers:@{@"Content-Type":@"application/json",
285-
@"Last-Modified":kLastModifiedDate}];
285+
headers:kCDNResponseHeaders];
286286
}];
287287
}
288288

0 commit comments

Comments
 (0)