From f17832a55f7e671f8451f72e8a9f6386b0eea212 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:05:39 -0800 Subject: [PATCH 01/10] Fix additional refinements not being parsed --- docs/api_ContentSearchApi.js.html | 17 ++++++++++++++++- docs/api_ProductSearchApi.js.html | 17 ++++++++++++++++- docs/index.html | 2 +- docs/module-api_ContentSearchApi.html | 2 +- docs/module-api_ProductSearchApi.html | 18 +++++++++--------- src/api/ContentSearchApi.js | 17 ++++++++++++++++- src/api/ProductSearchApi.js | 17 ++++++++++++++++- 7 files changed, 75 insertions(+), 15 deletions(-) diff --git a/docs/api_ContentSearchApi.js.html b/docs/api_ContentSearchApi.js.html index 91e96da..b0ce0ea 100644 --- a/docs/api_ContentSearchApi.js.html +++ b/docs/api_ContentSearchApi.js.html @@ -93,12 +93,27 @@

Source: api/ContentSearchApi.js

const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: this.apiClient.buildCollectionParam(opts.sort, 'csv'), start: opts.start, count: opts.count, locale: opts.locale } + + const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) + + if (refinements) { + const useSuffix = refinements.length > 0 + + refinements.forEach((key, idx) => { + if (!opts[key]) { + return + } + + queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = + this.apiClient.buildCollectionParam(opts[key], 'csv') + }) + } + const headerParams = {} const formParams = {} diff --git a/docs/api_ProductSearchApi.js.html b/docs/api_ProductSearchApi.js.html index ca0527a..90a79f7 100644 --- a/docs/api_ProductSearchApi.js.html +++ b/docs/api_ProductSearchApi.js.html @@ -95,7 +95,6 @@

Source: api/ProductSearchApi.js

const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, @@ -103,6 +102,22 @@

Source: api/ProductSearchApi.js

currency: opts.currency, locale: opts.locale } + + const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) + + if (refinements) { + const useSuffix = refinements.length > 0 + + refinements.forEach((key, idx) => { + if (!opts[key]) { + return + } + + queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = + this.apiClient.buildCollectionParam(opts[key], 'csv') + }) + } + const headerParams = {} const formParams = {} diff --git a/docs/index.html b/docs/index.html index 76a4650..4ad50c1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -52,7 +52,7 @@

/ /

NPM

CircleCI

-

Introduction

ShopApi - JavaScript client for Salesforce Commerce Cloud OCAPI Shop API.

+

Introduction

ShopApi - ES6 JavaScript client for Salesforce Commerce Cloud OCAPI Shop API.

diff --git a/docs/module-api_ContentSearchApi.html b/docs/module-api_ContentSearchApi.html index 03981f2..90e750f 100644 --- a/docs/module-api_ContentSearchApi.html +++ b/docs/module-api_ContentSearchApi.html @@ -473,7 +473,7 @@
Properties
Source:
diff --git a/docs/module-api_ProductSearchApi.html b/docs/module-api_ProductSearchApi.html index bfdd94b..0ba163c 100644 --- a/docs/module-api_ProductSearchApi.html +++ b/docs/module-api_ProductSearchApi.html @@ -523,7 +523,7 @@
Properties
Source:
@@ -856,7 +856,7 @@
Properties
Source:
@@ -1189,7 +1189,7 @@
Properties
Source:
@@ -1522,7 +1522,7 @@
Properties
Source:
@@ -1855,7 +1855,7 @@
Properties
Source:
@@ -2210,7 +2210,7 @@
Properties
Source:
@@ -2566,7 +2566,7 @@
Properties
Source:
@@ -2898,7 +2898,7 @@
Properties
Source:
@@ -3230,7 +3230,7 @@
Properties
Source:
diff --git a/src/api/ContentSearchApi.js b/src/api/ContentSearchApi.js index 83525fc..dd65a4a 100644 --- a/src/api/ContentSearchApi.js +++ b/src/api/ContentSearchApi.js @@ -65,12 +65,27 @@ export default class ContentSearchApi { const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: this.apiClient.buildCollectionParam(opts.sort, 'csv'), start: opts.start, count: opts.count, locale: opts.locale } + + const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) + + if (refinements) { + const useSuffix = refinements.length > 0 + + refinements.forEach((key, idx) => { + if (!opts[key]) { + return + } + + queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = + this.apiClient.buildCollectionParam(opts[key], 'csv') + }) + } + const headerParams = {} const formParams = {} diff --git a/src/api/ProductSearchApi.js b/src/api/ProductSearchApi.js index 906606e..9b7e1e0 100644 --- a/src/api/ProductSearchApi.js +++ b/src/api/ProductSearchApi.js @@ -67,7 +67,6 @@ export default class ProductSearchApi { const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, @@ -75,6 +74,22 @@ export default class ProductSearchApi { currency: opts.currency, locale: opts.locale } + + const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) + + if (refinements) { + const useSuffix = refinements.length > 0 + + refinements.forEach((key, idx) => { + if (!opts[key]) { + return + } + + queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = + this.apiClient.buildCollectionParam(opts[key], 'csv') + }) + } + const headerParams = {} const formParams = {} From f779cfcdd138a994ecddacc75b8c0f5f64075a7d Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:06:53 -0800 Subject: [PATCH 02/10] Update change log --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3fb143..9542022 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## To be released +- Fix refine option processing to include refine_1 ... refine_n alternatives + ## v0.1.0 (November 6, 2017) - Module name change - Add ASCII art From f133e5f85351e9148f83104c70a172d8f3fa6da9 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:15:00 -0800 Subject: [PATCH 03/10] Fix condition to check length --- src/api/ContentSearchApi.js | 2 +- src/api/ProductSearchApi.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/ContentSearchApi.js b/src/api/ContentSearchApi.js index dd65a4a..d057c59 100644 --- a/src/api/ContentSearchApi.js +++ b/src/api/ContentSearchApi.js @@ -73,7 +73,7 @@ export default class ContentSearchApi { const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - if (refinements) { + if (refinements.lengh > 0) { const useSuffix = refinements.length > 0 refinements.forEach((key, idx) => { diff --git a/src/api/ProductSearchApi.js b/src/api/ProductSearchApi.js index 9b7e1e0..dcad979 100644 --- a/src/api/ProductSearchApi.js +++ b/src/api/ProductSearchApi.js @@ -77,7 +77,7 @@ export default class ProductSearchApi { const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - if (refinements) { + if (refinements.lengh > 0) { const useSuffix = refinements.length > 0 refinements.forEach((key, idx) => { From ec462fe37eb305bd2e66f94d3b13fafd42d33131 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:22:38 -0800 Subject: [PATCH 04/10] Fix when refine number suffix should be used --- src/api/ContentSearchApi.js | 2 +- src/api/ProductSearchApi.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/ContentSearchApi.js b/src/api/ContentSearchApi.js index d057c59..40a2863 100644 --- a/src/api/ContentSearchApi.js +++ b/src/api/ContentSearchApi.js @@ -74,7 +74,7 @@ export default class ContentSearchApi { const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) if (refinements.lengh > 0) { - const useSuffix = refinements.length > 0 + const useSuffix = refinements.length > 1 refinements.forEach((key, idx) => { if (!opts[key]) { diff --git a/src/api/ProductSearchApi.js b/src/api/ProductSearchApi.js index dcad979..8a74f96 100644 --- a/src/api/ProductSearchApi.js +++ b/src/api/ProductSearchApi.js @@ -78,7 +78,7 @@ export default class ProductSearchApi { const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) if (refinements.lengh > 0) { - const useSuffix = refinements.length > 0 + const useSuffix = refinements.length > 1 refinements.forEach((key, idx) => { if (!opts[key]) { From 99fc17c8abf64170522fece51211536d6ca0f6c1 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:34:04 -0800 Subject: [PATCH 05/10] Fix typo --- src/api/ContentSearchApi.js | 2 +- src/api/ProductSearchApi.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/ContentSearchApi.js b/src/api/ContentSearchApi.js index 40a2863..70dd009 100644 --- a/src/api/ContentSearchApi.js +++ b/src/api/ContentSearchApi.js @@ -73,7 +73,7 @@ export default class ContentSearchApi { const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - if (refinements.lengh > 0) { + if (refinements.length > 0) { const useSuffix = refinements.length > 1 refinements.forEach((key, idx) => { diff --git a/src/api/ProductSearchApi.js b/src/api/ProductSearchApi.js index 8a74f96..e388e9f 100644 --- a/src/api/ProductSearchApi.js +++ b/src/api/ProductSearchApi.js @@ -77,7 +77,7 @@ export default class ProductSearchApi { const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - if (refinements.lengh > 0) { + if (refinements.length > 0) { const useSuffix = refinements.length > 1 refinements.forEach((key, idx) => { From b296a2b47a03f7db4aa2df35e0499c7a8c89cc06 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:43:20 -0800 Subject: [PATCH 06/10] Update docs, refactor refine option creation to client --- docs/ApiClient.js.html | 26 ++++ docs/api_ContentSearchApi.js.html | 15 +-- docs/api_ProductSearchApi.js.html | 31 ++--- docs/module-ApiClient.html | 170 +++++++++++++++++++++++++- docs/module-api_ContentSearchApi.html | 2 +- docs/module-api_ProductSearchApi.html | 18 +-- src/ApiClient.js | 26 ++++ src/api/ContentSearchApi.js | 15 +-- src/api/ProductSearchApi.js | 31 ++--- 9 files changed, 254 insertions(+), 80 deletions(-) diff --git a/docs/ApiClient.js.html b/docs/ApiClient.js.html index b5f0b5c..3ac13b8 100644 --- a/docs/ApiClient.js.html +++ b/docs/ApiClient.js.html @@ -346,6 +346,32 @@

Source: ApiClient.js

} } + /** + * Builds an object with refinement keys 1..n given a options object.. + * @param {Object} opts Optional parameters + * @returns {Object} An object with refinement keys numbered 1 ... n with their + * string representation value. + */ + buildRefineParams(opts) { + const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) + const queryParams = {} + + if (refinements.length > 0) { + const useSuffix = refinements.length > 1 + + refinements.forEach((key, idx) => { + if (!opts[key]) { + return + } + + queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = + this.buildCollectionParam(opts[key], 'csv') + }) + } + + return queryParams + } + /** * Applies authentication headers to the request. * @param {Object} request The request object created by a <code>superagent()</code> call. diff --git a/docs/api_ContentSearchApi.js.html b/docs/api_ContentSearchApi.js.html index b0ce0ea..7bdc4f1 100644 --- a/docs/api_ContentSearchApi.js.html +++ b/docs/api_ContentSearchApi.js.html @@ -99,20 +99,7 @@

Source: api/ContentSearchApi.js

locale: opts.locale } - const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - - if (refinements) { - const useSuffix = refinements.length > 0 - - refinements.forEach((key, idx) => { - if (!opts[key]) { - return - } - - queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = - this.apiClient.buildCollectionParam(opts[key], 'csv') - }) - } + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) const headerParams = {} const formParams = {} diff --git a/docs/api_ProductSearchApi.js.html b/docs/api_ProductSearchApi.js.html index 90a79f7..1003843 100644 --- a/docs/api_ProductSearchApi.js.html +++ b/docs/api_ProductSearchApi.js.html @@ -103,20 +103,7 @@

Source: api/ProductSearchApi.js

locale: opts.locale } - const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - - if (refinements) { - const useSuffix = refinements.length > 0 - - refinements.forEach((key, idx) => { - if (!opts[key]) { - return - } - - queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = - this.apiClient.buildCollectionParam(opts[key], 'csv') - }) - } + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) const headerParams = {} const formParams = {} @@ -198,12 +185,14 @@

Source: api/ProductSearchApi.js

const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} @@ -279,12 +268,14 @@

Source: api/ProductSearchApi.js

const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} @@ -361,13 +352,15 @@

Source: api/ProductSearchApi.js

const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, currency: opts.currency, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} @@ -442,12 +435,14 @@

Source: api/ProductSearchApi.js

const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} diff --git a/docs/module-ApiClient.html b/docs/module-ApiClient.html index 8bd483b..8f67073 100644 --- a/docs/module-ApiClient.html +++ b/docs/module-ApiClient.html @@ -732,7 +732,7 @@
Parameters:
Source:
@@ -905,7 +905,7 @@
Parameters:
Source:
@@ -1050,7 +1050,7 @@
Parameters:
Source:
@@ -1230,7 +1230,7 @@
Parameters:
Source:
@@ -1448,6 +1448,164 @@
Returns:
+

buildRefineParams(opts) → {Object}

+ + + + + + +
+

Builds an object with refinement keys 1..n given a options object..

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Optional parameters

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

An object with refinement keys numbered 1 ... n with their +string representation value.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + + + +

buildUrl(path, pathParams) → {String}

@@ -1967,7 +2125,7 @@
Parameters:
Source:
@@ -2159,7 +2317,7 @@
Parameters:
Source:
diff --git a/docs/module-api_ContentSearchApi.html b/docs/module-api_ContentSearchApi.html index 90e750f..dc8bde8 100644 --- a/docs/module-api_ContentSearchApi.html +++ b/docs/module-api_ContentSearchApi.html @@ -473,7 +473,7 @@
Properties
Source:
diff --git a/docs/module-api_ProductSearchApi.html b/docs/module-api_ProductSearchApi.html index 0ba163c..3af3154 100644 --- a/docs/module-api_ProductSearchApi.html +++ b/docs/module-api_ProductSearchApi.html @@ -523,7 +523,7 @@
Properties
Source:
@@ -856,7 +856,7 @@
Properties
Source:
@@ -1189,7 +1189,7 @@
Properties
Source:
@@ -1522,7 +1522,7 @@
Properties
Source:
@@ -1855,7 +1855,7 @@
Properties
Source:
@@ -2210,7 +2210,7 @@
Properties
Source:
@@ -2566,7 +2566,7 @@
Properties
Source:
@@ -2898,7 +2898,7 @@
Properties
Source:
@@ -3230,7 +3230,7 @@
Properties
Source:
diff --git a/src/ApiClient.js b/src/ApiClient.js index b670753..7d95951 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -318,6 +318,32 @@ export default class ApiClient { } } + /** + * Builds an object with refinement keys 1..n given a options object.. + * @param {Object} opts Optional parameters + * @returns {Object} An object with refinement keys numbered 1 ... n with their + * string representation value. + */ + buildRefineParams(opts) { + const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) + const queryParams = {} + + if (refinements.length > 0) { + const useSuffix = refinements.length > 1 + + refinements.forEach((key, idx) => { + if (!opts[key]) { + return + } + + queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = + this.buildCollectionParam(opts[key], 'csv') + }) + } + + return queryParams + } + /** * Applies authentication headers to the request. * @param {Object} request The request object created by a superagent() call. diff --git a/src/api/ContentSearchApi.js b/src/api/ContentSearchApi.js index 70dd009..490196b 100644 --- a/src/api/ContentSearchApi.js +++ b/src/api/ContentSearchApi.js @@ -71,20 +71,7 @@ export default class ContentSearchApi { locale: opts.locale } - const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - - if (refinements.length > 0) { - const useSuffix = refinements.length > 1 - - refinements.forEach((key, idx) => { - if (!opts[key]) { - return - } - - queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = - this.apiClient.buildCollectionParam(opts[key], 'csv') - }) - } + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) const headerParams = {} const formParams = {} diff --git a/src/api/ProductSearchApi.js b/src/api/ProductSearchApi.js index e388e9f..9da812e 100644 --- a/src/api/ProductSearchApi.js +++ b/src/api/ProductSearchApi.js @@ -75,20 +75,7 @@ export default class ProductSearchApi { locale: opts.locale } - const refinements = Object.keys(opts).filter((key) => /^refine/.test(key)) - - if (refinements.length > 0) { - const useSuffix = refinements.length > 1 - - refinements.forEach((key, idx) => { - if (!opts[key]) { - return - } - - queryParams[`refine${useSuffix ? `_${idx + 1}` : ''}`] = - this.apiClient.buildCollectionParam(opts[key], 'csv') - }) - } + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) const headerParams = {} const formParams = {} @@ -170,12 +157,14 @@ export default class ProductSearchApi { const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} @@ -251,12 +240,14 @@ export default class ProductSearchApi { const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} @@ -333,13 +324,15 @@ export default class ProductSearchApi { const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, currency: opts.currency, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} @@ -414,12 +407,14 @@ export default class ProductSearchApi { const pathParams = {} const queryParams = { q: opts.q, - refine: this.apiClient.buildCollectionParam(opts.refine, 'csv'), sort: opts.sort, start: opts.start, count: opts.count, locale: opts.locale } + + Object.assign(queryParams, this.apiClient.buildRefineParams(opts)) + const headerParams = {} const formParams = {} From 8d7d76020bbe7ca5aa6b63403d10a1caf13a0251 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:45:05 -0800 Subject: [PATCH 07/10] Remove imcomplete test for priceadjustments --- test/api/PriceAdjustmentLimitsApi.spec.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/api/PriceAdjustmentLimitsApi.spec.js b/test/api/PriceAdjustmentLimitsApi.spec.js index c492cc8..216bb67 100644 --- a/test/api/PriceAdjustmentLimitsApi.spec.js +++ b/test/api/PriceAdjustmentLimitsApi.spec.js @@ -59,14 +59,6 @@ describe('PriceAdjustmentLimitsApi', () => { // if (error) throw error; // expect().to.be(); // }); - instance.getPriceAdjustmentLimits() - .then((thing) => { - console.log('thing: ', thing) - }) - .catch((fault) => { - console.log('fault: ', fault) - }) - return Promise.resolve() }) }) }) From 0f70178c009be3100155d779084a20ec537d2037 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:50:26 -0800 Subject: [PATCH 08/10] =?UTF-8?q?Use=20=E2=80=98es=E2=80=99=20format=20for?= =?UTF-8?q?=20rollup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index 886b5ec..b5862ed 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,7 +2,7 @@ export default { input: 'src/index.js', output: { file: 'lib/index.js', - format: 'cjs' + format: 'es' }, external: ['superagent', 'querystring'], } From cda7ba988d92632e856fdf85f7ce599a8555b6cb Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 6 Nov 2017 16:51:14 -0800 Subject: [PATCH 09/10] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9542022..34fc940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## To be released - Fix refine option processing to include refine_1 ... refine_n alternatives +- Fix rollup format 'cjs' --> 'es' ## v0.1.0 (November 6, 2017) - Module name change From 56d5e5dc2c228c423411b8a66a9cba20819cd6ca Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Tue, 7 Nov 2017 11:25:05 -0800 Subject: [PATCH 10/10] Add test for multiple refinements --- test/api/ProductSearchApi.spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/api/ProductSearchApi.spec.js b/test/api/ProductSearchApi.spec.js index 85459d2..5b9012d 100644 --- a/test/api/ProductSearchApi.spec.js +++ b/test/api/ProductSearchApi.spec.js @@ -61,6 +61,17 @@ describe('ProductSearchApi', () => { expect(productSearchResult.count).to.above(0) }) ) + + it('should call getProductSearch with multiple refinments successfully', () => + instance.getProductSearch({ + refine_1: ['cgid=root'], + refine_2: ['c_refinementColor=Navy'] + }) + .then((productSearchResult) => { + expect(productSearchResult.selected_refinements.cgid).to.be('root') + expect(productSearchResult.selected_refinements.c_refinementColor).to.be('Navy') + }) + ) }) describe('getProductSearchAvailability', () => {