@@ -87,7 +87,7 @@ class ConstructorIOIntegrationTests: XCTestCase {
8787
8888 func testSearchResultClick( ) {
8989 let expectation = XCTestExpectation ( description: " Tracking 204 " )
90- let request = self . constructor. trackSearchResultClick ( itemName: itemName, customerID: customerID, searchTerm: searchTerm, sectionName: sectionName, resultID: nil , completionHandler: { response in
90+ self . constructor. trackSearchResultClick ( itemName: itemName, customerID: customerID, searchTerm: searchTerm, sectionName: sectionName, resultID: nil , completionHandler: { response in
9191 let cioError = response. error as? CIOError
9292 XCTAssertNil ( cioError)
9393 expectation. fulfill ( )
@@ -97,7 +97,7 @@ class ConstructorIOIntegrationTests: XCTestCase {
9797
9898 func testBrowseResultsLoaded( ) {
9999 let expectation = XCTestExpectation ( description: " Tracking 204 " )
100- var request = self . constructor. trackBrowseResultsLoaded ( filterName: filterName, filterValue: filterValue, resultCount: resultCount, resultID: nil , completionHandler: { response in
100+ self . constructor. trackBrowseResultsLoaded ( filterName: filterName, filterValue: filterValue, resultCount: resultCount, resultID: nil , completionHandler: { response in
101101 let cioError = response. error as? CIOError
102102 XCTAssertNil ( cioError)
103103 expectation. fulfill ( )
@@ -156,7 +156,7 @@ class ConstructorIOIntegrationTests: XCTestCase {
156156 }
157157
158158 func testRecommendations( ) {
159- let expectation = XCTestExpectation ( description: " Request 200 " )
159+ let expectation = XCTestExpectation ( description: " Request 204 " )
160160 let query = CIORecommendationsQuery ( podID: podID, itemID: customerID, section: sectionName)
161161 self . constructor. recommendations ( forQuery: query, completionHandler: { response in
162162 let cioError = response. error as? CIOError
@@ -170,4 +170,82 @@ class ConstructorIOIntegrationTests: XCTestCase {
170170 } )
171171 self . wait ( for: expectation)
172172 }
173+
174+ func testAutocomplete( ) {
175+ let expectation = XCTestExpectation ( description: " Request 204 " )
176+ let query = CIOAutocompleteQuery ( query: " a " , filters: nil , numResults: 20 )
177+ self . constructor. autocomplete ( forQuery: query, completionHandler: { response in
178+ let cioError = response. error as? CIOError
179+ XCTAssertNil ( cioError)
180+ expectation. fulfill ( )
181+ } )
182+ self . wait ( for: expectation)
183+ }
184+
185+ func testAutocomplete_WithFilters( ) {
186+ let expectation = XCTestExpectation ( description: " Request 204 " )
187+ let facetFilters = [
188+ ( key: " Brand " , value: " A&W " )
189+ ]
190+ let queryFilters = CIOQueryFilters ( groupFilter: nil , facetFilters: facetFilters)
191+ let query = CIOAutocompleteQuery ( query: " a " , filters: queryFilters, numResults: 20 )
192+ self . constructor. autocomplete ( forQuery: query, completionHandler: { response in
193+ let cioError = response. error as? CIOError
194+ XCTAssertNil ( cioError)
195+ expectation. fulfill ( )
196+ } )
197+ self . wait ( for: expectation)
198+ }
199+
200+ func testSearch( ) {
201+ let expectation = XCTestExpectation ( description: " Request 204 " )
202+ let query = CIOSearchQuery ( query: " a " , filters: nil )
203+ self . constructor. search ( forQuery: query, completionHandler: { response in
204+ let cioError = response. error as? CIOError
205+ XCTAssertNil ( cioError)
206+ expectation. fulfill ( )
207+ } )
208+ self . wait ( for: expectation)
209+ }
210+
211+ func testSearch_WithFilters( ) {
212+ let expectation = XCTestExpectation ( description: " Request 204 " )
213+ let facetFilters = [
214+ ( key: " Brand " , value: " A&W " )
215+ ]
216+ let queryFilters = CIOQueryFilters ( groupFilter: " 101 " , facetFilters: facetFilters)
217+ let query = CIOSearchQuery ( query: " a " , filters: queryFilters)
218+ self . constructor. search ( forQuery: query, completionHandler: { response in
219+ let cioError = response. error as? CIOError
220+ XCTAssertNil ( cioError)
221+ expectation. fulfill ( )
222+ } )
223+ self . wait ( for: expectation)
224+ }
225+
226+ func testBrowse( ) {
227+ let expectation = XCTestExpectation ( description: " Request 204 " )
228+ let query = CIOBrowseQuery ( filterName: " group_id " , filterValue: " 431 " )
229+ self . constructor. browse ( forQuery: query, completionHandler: { response in
230+ let cioError = response. error as? CIOError
231+ XCTAssertNil ( cioError)
232+ expectation. fulfill ( )
233+ } )
234+ self . wait ( for: expectation)
235+ }
236+
237+ func testBrowse_WithFilters( ) {
238+ let expectation = XCTestExpectation ( description: " Request 204 " )
239+ let facetFilters = [
240+ ( key: " Brand " , value: " A&W " )
241+ ]
242+ let queryFilters = CIOQueryFilters ( groupFilter: " 101 " , facetFilters: facetFilters)
243+ let query = CIOBrowseQuery ( filterName: " group_id " , filterValue: " 431 " , filters: queryFilters)
244+ self . constructor. browse ( forQuery: query, completionHandler: { response in
245+ let cioError = response. error as? CIOError
246+ XCTAssertNil ( cioError)
247+ expectation. fulfill ( )
248+ } )
249+ self . wait ( for: expectation)
250+ }
173251}
0 commit comments