diff --git a/src/buildURL.js b/src/buildURL.js index 36540df..d283f41 100644 --- a/src/buildURL.js +++ b/src/buildURL.js @@ -24,6 +24,7 @@ const buildURL = { baseUrl += options.additionalParam ? '&' + options.additionalParam : ''; baseUrl += options.sortOrder ? '&sortOrder=' + options.sortOrder : ''; baseUrl += '&outputSelector(0)=SellerInfo'; + baseUrl += '&outputSelector(1)=PictureURLLarge'; baseUrl += options.limit ? '&paginationInput.entriesPerPage=' + options.limit : ''; baseUrl += options.globalID ? '&GLOBAL-ID=' + options.globalID : ''; baseUrl += options.pageNumber ? '&paginationInput.pageNumber=' + options.pageNumber : ''; diff --git a/test/buildURL.test.js b/test/buildURL.test.js index 85f30ae..eb8dd70 100644 --- a/test/buildURL.test.js +++ b/test/buildURL.test.js @@ -7,7 +7,7 @@ describe('test building url methods', () => { it('test search url', () => { - let expected_search_url = 'https://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=testID&OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&keywords=iphone&outputSelector(0)=SellerInfo&paginationInput.entriesPerPage=6&GLOBAL-ID=EBAY-US' + let expected_search_url = 'https://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=testID&OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&keywords=iphone&outputSelector(0)=SellerInfo&outputSelector(1)=PictureURLLarge&paginationInput.entriesPerPage=6&GLOBAL-ID=EBAY-US'; let options = { name: 'iphone', operationName: 'findItemsByKeywords', @@ -16,24 +16,24 @@ describe('test building url methods', () => { limit: 6, globalID: 'EBAY-US', baseSvcUrl: 'svcs.ebay.com' - } + }; expect(buildURL.buildSearchUrl(options)).to.be.equal(expected_search_url); }); it('test Shopping url without selector', () => { - let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone' + let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone'; let options = { name: 'iphone', operationName: 'demoShoppingName', param: 'keywords', clientID: 'testID', baseUrl: 'open.api.ebay.com' - } + }; expect(buildURL.buildShoppingUrl(options)).to.be.equal(expected_search_url); }); it('test Shopping url including selector', () => { - let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone&IncludeSelector=true' + let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone&IncludeSelector=true'; let options = { name: 'iphone', operationName: 'demoShoppingName', @@ -41,7 +41,7 @@ describe('test building url methods', () => { clientID: 'testID', includeSelector: true, baseUrl: 'open.api.ebay.com' - } + }; expect(buildURL.buildShoppingUrl(options)).to.be.equal(expected_search_url); }); }); diff --git a/test/findingApi.test.js b/test/findingApi.test.js index 0c5d3c0..f09998c 100644 --- a/test/findingApi.test.js +++ b/test/findingApi.test.js @@ -12,20 +12,20 @@ describe('test ebay finding Api', () => { let ebay = new eBay({ clientID: 'ClientId' }); - expect(() => { ebay.findItemsByCategory() }).to.throw('Category ID is null or invalid'); + expect(() => { ebay.findItemsByCategory(); }).to.throw('Category ID is null or invalid'); }); it('test findCompletedItemswith required params', () => { let ebay = new eBay({ clientID: 'ClientId' }); - expect(() => { ebay.findCompletedItems('') }).to.throw('Keyword or category ID are required.'); + expect(() => { ebay.findCompletedItems(''); }).to.throw('Keyword or category ID are required.'); }); }); describe('test constructAdditionalParams', () => { it('test constructAdditionalParams with required params', () => { - let expected_param = 'keywords=iphone&categoryId=111&sortOrder=PricePlusShippingLowest' + let expected_param = 'keywords=iphone&categoryId=111&sortOrder=PricePlusShippingLowest'; const options = { keywords: 'iphone', categoryId: '111', @@ -88,7 +88,7 @@ describe('test ebay finding Api', () => { let ebay = new eBay({ clientID: 'ABCD' }); - nockFindingApi.get('/services/search/FindingService/v1?SECURITY-APPNAME=ABCD&OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&paginationInput.entriesPerPage=2&keywords=ipad&itemFilter(0).name=ExpeditedShippingType&itemFilter(0).value=OneDayShipping&outputSelector(0)=SellerInfo&GLOBAL-ID=EBAY-US') + nockFindingApi.get('/services/search/FindingService/v1?SECURITY-APPNAME=ABCD&OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&paginationInput.entriesPerPage=2&keywords=ipad&itemFilter(0).name=ExpeditedShippingType&itemFilter(0).value=OneDayShipping&outputSelector(0)=SellerInfo&outputSelector(1)=PictureURLLarge&GLOBAL-ID=EBAY-US') .reply(200, { "findItemsAdvancedResponse": [{ "ack": ["Success"] }] }); return ebay.findItemsAdvanced({ entriesPerPage: 2, @@ -100,5 +100,5 @@ describe('test ebay finding Api', () => { console.log(error); }); }); - }) + }); }); \ No newline at end of file