This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(error-handling): don't show special error text on duplicatio…
…n errors the initial idea was to show a special error message that tells the user that the import currently does not support updating. But if the user did not want to update something in the first place he would be interested in knowing which field was causing the duplication error. That's why we now show the original error from the API.
- Loading branch information
philippspo
committed
Mar 9, 2016
1 parent
0fbe7c1
commit e3f07ff
Showing
2 changed files
with
10 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,14 +158,15 @@ describe('customer import module', () => { | |
}) | ||
|
||
it('should handle existing customers', (done) => { | ||
const error = { | ||
body: { | ||
errors: [{ | ||
code: 'DuplicateField' | ||
}] | ||
} | ||
} | ||
const mockCustomerSave = () => { | ||
return Promise.reject({ | ||
body: { | ||
errors: [{ | ||
code: 'DuplicateField' | ||
}] | ||
} | ||
}) | ||
return Promise.reject(error) | ||
} | ||
sinon.stub(importer.client.customers, 'save', mockCustomerSave) | ||
const customer = { email: '[email protected]' } | ||
|
@@ -174,7 +175,7 @@ describe('customer import module', () => { | |
const actual = importer.summary.errors[0] | ||
const expected = { | ||
customer, | ||
error: 'updating customers is not implement yet' | ||
error: error | ||
} | ||
expect(actual).to.deep.equal(expected) | ||
importer.client.customers.save.restore() | ||
|