diff --git a/CHANGELOG.md b/CHANGELOG.md index 73a1343..c54ca77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## To be released +- Update `Fault` model to have `arguments` property. [#18](https://github.com/mobify/commercecloud-ocapi-client/pull/18) + ## v0.1.7 (February 5, 2019) - Add relevant properties to `VariationAttributeValue` model and some others. [#15](https://github.com/mobify/commercecloud-ocapi-client/pull/15) diff --git a/package-lock.json b/package-lock.json index 11542fb..cdbc66c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "commercecloud-ocapi-client", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/models/Fault.js b/src/models/Fault.js index 249f809..ad15f9e 100644 --- a/src/models/Fault.js +++ b/src/models/Fault.js @@ -41,6 +41,12 @@ export default class Fault { * @member {String} type */ this.type = undefined + + /** + * These are optional arguments returned with fault + * @member {Object} arguments + */ + this.arguments = undefined } /** @@ -62,6 +68,9 @@ export default class Fault { if (data.hasOwnProperty('type')) { obj['type'] = ApiClient.convertToType(data['type'], 'String') } + if (data.hasOwnProperty('arguments')) { + obj['arguments'] = ApiClient.convertToType(data['arguments'], {String: Object}) + } } return obj diff --git a/test/api/StoresApi.spec.js b/test/api/StoresApi.spec.js index d672ecf..87cde7a 100644 --- a/test/api/StoresApi.spec.js +++ b/test/api/StoresApi.spec.js @@ -75,6 +75,14 @@ describe('StoresApi', () => { expect(store.constructor.name).to.be('Store') }) ) + + it('should throw Fault when calling getStoresByID with unknown store id', () => { + instance.getStoresByID('badstoreid') + .catch((fault) => { + expect(fault.constructor.name).to.be('Fault') + console.log('fault: ', fault) + }) + }) }) describe('getStoresByIDs', () => {