-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: error handler throw detail error message
- Loading branch information
Minkyu Yang
authored and
Minkyu Yang
committed
Feb 13, 2020
1 parent
5fc8017
commit c636db0
Showing
2 changed files
with
55 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,57 @@ | ||
import { expect } from 'chai' | ||
import fetch from 'fetch-everywhere' | ||
import { createClient } from './index' | ||
|
||
import { expect } from 'chai'; | ||
import fetch from 'fetch-everywhere'; | ||
import { createClient } from './index'; | ||
|
||
describe('Shopify index', () => { | ||
it('fetch can be overridden', () => { | ||
const shopify = new createClient({ | ||
store_name: 'XXX', | ||
client_key: 'XXX', | ||
client_pass: 'XXX', | ||
fetch: fetch | ||
}) | ||
expect(shopify.fetch).to.be.an.instanceof(Function) | ||
}) | ||
it('fetch can be overridden', () => { | ||
const shopify = new createClient({ | ||
store_name: 'XXX', | ||
client_key: 'XXX', | ||
client_pass: 'XXX', | ||
fetch: fetch | ||
}); | ||
expect(shopify.fetch).to.be.an.instanceof(Function); | ||
}); | ||
|
||
it('get products', () => { | ||
const shopify = new createClient({ | ||
store_name: 'XXX', | ||
client_key: 'XXX', | ||
client_pass: 'XXX', | ||
fetch: fetch | ||
}) | ||
it('get products', () => { | ||
const shopify = new createClient({ | ||
store_name: 'XXX', | ||
client_key: 'XXX', | ||
client_pass: 'XXX', | ||
fetch: fetch | ||
}); | ||
|
||
return shopify | ||
.get('admin/products.json') | ||
.then(results => { | ||
expect(results).to.not.be.null | ||
}) | ||
.catch(error => { | ||
expect(error).to.deep.equal({ statusCode: 404, body: { message: 'Not Found' } }) | ||
}) | ||
}) | ||
return shopify | ||
.get('admin/products.json') | ||
.then(results => { | ||
expect(results).to.not.be.null; | ||
}) | ||
.catch(error => { | ||
expect(error).to.deep.equal({ | ||
statusCode: 404, | ||
body: { message: 'Not Found', errors: 'Not Found' } | ||
}); | ||
}); | ||
}); | ||
|
||
it('get products with custom fetch', () => { | ||
const shopify = new createClient({ | ||
store_name: 'XXX', | ||
client_key: 'XXX', | ||
client_pass: 'XXX', | ||
fetch: fetch | ||
}) | ||
it('get products with custom fetch', () => { | ||
const shopify = new createClient({ | ||
store_name: 'XXX', | ||
client_key: 'XXX', | ||
client_pass: 'XXX', | ||
fetch: fetch | ||
}); | ||
|
||
return shopify | ||
.get('admin/products.json') | ||
.then(results => { | ||
expect(results).to.not.be.null | ||
}) | ||
.catch(error => { | ||
expect(error).to.deep.equal({ statusCode: 404, body: { message: 'Not Found' } }) | ||
}) | ||
}) | ||
}) | ||
return shopify | ||
.get('admin/products.json') | ||
.then(results => { | ||
expect(results).to.not.be.null; | ||
}) | ||
.catch(error => { | ||
expect(error).to.deep.equal({ | ||
statusCode: 404, | ||
body: { message: 'Not Found', errors: 'Not Found' } | ||
}); | ||
}); | ||
}); | ||
}); |
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