Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Update Fault Model #18

Merged
merged 5 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/models/Fault.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/api/StoresApi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down