Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
07942801
Commit
07942801
authored
Jun 02, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicate tests. Add BUYCollection sort conversion tests.
parent
c1ac37fc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
84 deletions
+13
-84
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+13
-84
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
07942801
...
@@ -169,99 +169,28 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -169,99 +169,28 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
XCTAssertEqual
(
BUYStatusComplete
,
status
);
XCTAssertEqual
(
BUYStatusComplete
,
status
);
}
}
-
(
void
)
test
ProductsInCollectionWithSortOrderCollectionDefault
-
(
void
)
test
SortConversion
{
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortBestSelling
],
@"best-selling"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortCreatedAscending
],
@"created-ascending"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortCreatedDescending
],
@"created-descending"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortPriceAscending
],
@"price-ascending"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortPriceDescending
],
@"price-descending"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortTitleAscending
],
@"title-ascending"
);
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=collection-default"
]];
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortTitleDescending
],
@"title-descending"
);
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
999
],
@"collection-default"
);
}
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
0
],
@"collection-default"
);
-
(
void
)
testProductsInCollectionWithSortOrderBestSelling
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortBestSelling
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=best-selling"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderCreatedAscending
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedAscending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=created-ascending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderCreatedDescending
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedDescending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=created-descending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderPriceAscending
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceAscending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=price-ascending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderPriceDescending
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceDescending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=price-descending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderTitleAscending
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortTitleAscending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=title-ascending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
}
-
(
void
)
testProductsInCollection
WithSortOrderTitleDescending
-
(
void
)
testProductsInCollection
{
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSort
TitleDescending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSort
CollectionDefault
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=
title-descending
"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=
collection-default
"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment