Commit 405f96fd by Brent Gulanowski

Add test for get collection by handle.

parent 6520928d
......@@ -253,6 +253,26 @@
}];
}
- (void)testCollectionHandle
{
[OHHTTPStubs stubUsingResponseWithKey:@"testGetCollection_0" useMocks:[self shouldUseMocks]];
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
[self.client getCollectionByHandle:@"frontpage" completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
XCTAssertNotNil(collection);
XCTAssertEqualObjects(@"Frontpage", collection.title);
XCTAssertEqualObjects(@109931075, collection.identifier);
XCTAssertNil(error);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:10 handler:^(NSError *error) {
XCTAssertNil(error);
}];
}
- (void)testProductsInCollection
{
if (self.collection == nil) {
......
......@@ -150,7 +150,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
return [self getRequestForURL:url completionHandler:^(NSDictionary *json, NSHTTPURLResponse *response, NSError *error) {
BUYCollection *collection = nil;
if (json && !error) {
collection = [self.modelManager buy_objectWithEntityName:[BUYCollection entityName] JSONDictionary:json];
collection = [self.modelManager buy_objectWithEntityName:[BUYCollection entityName] JSONDictionary:json[BUYCollectionsKey][0]];
}
block(collection, error);
}];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment