-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathindex.test.js
55 lines (49 loc) · 1.76 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const expect = require('chai').expect;
const should = require('chai').should();
const Ebay = require('../src/index');
describe('check all the options provided is valid or not - Ebay Constructor ', () => {
it('check input is provided or not', () => {
expect(() => {
new Ebay();
}).to.throw('Options is missing, please provide the input');
});
it('should have client ID', () => {
const ebayApi = new Ebay({ clientID: '12345' });
ebayApi.options.should.have.property('clientID');
});
it('should not have client ID', () => {
expect(() => {
new Ebay({});
}).to.throw('Client ID is Missing\ncheck documentation to get Client ID http://developer.ebay.com/DevZone/account/');
});
it('check instance of Ebay', () => {
const ebayApi = new Ebay({ clientID: '12345' });
expect(ebayApi).to.be.a.instanceOf(Ebay);
});
it('test default params', () => {
const ebay = new Ebay({
clientID: 'ClientId'
});
const expected = {
clientID: 'ClientId',
env: 'PROD',
baseUrl: 'api.ebay.com',
baseSvcUrl: 'svcs.ebay.com',
oauthEndpoint: 'https://auth.ebay.com/oauth2/authorize',
globalID: 'EBAY-US',
siteId: '0'
};
expect(ebay.options).to.deep.equal(expected);
});
it('test site id, env and country code', () => {
const ebay = new Ebay({
clientID: 'ClientId',
siteId: 3,
env: 'SANDBOX',
countryCode: 'EBAY_UK'
});
expect(ebay.options.siteId).to.equals(3);
expect(ebay.options.env).to.equals('SANDBOX');
expect(ebay.options.globalID).to.equals('EBAY_UK');
});
});