Skip to content

Commit

Permalink
Maintenance of deps [ch5147] (#30)
Browse files Browse the repository at this point in the history
* [ch5147] npm deps updated, fixed test, removed debug comments

* [ch5147] updated pre-commit script name
  • Loading branch information
bogdanguranda authored and pkopac committed Jul 3, 2018
1 parent d10ec63 commit 3b882a8
Showing 4 changed files with 19 additions and 17 deletions.
3 changes: 1 addition & 2 deletions lib/chartmogul/resource.js
Original file line number Diff line number Diff line change
@@ -69,9 +69,8 @@ class Resource {
},
json: true
};
// console.log(options);

request(options, (error, response, body) => {
// console.log(error, response, body);
if (error) {
callback(error, null);
return reject(error);
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
"test": "mocha",
"lint": "eslint --fix .",
"cover": "istanbul cover ./node_modules/mocha/bin/_mocha",
"prepublish": "npm run lint && npm run test"
"prepare": "npm run lint && npm run test"
},
"repository": {
"type": "git",
@@ -30,7 +30,7 @@
"node": ">=4"
},
"dependencies": {
"request": "^2.72.0",
"request": "^2.87.0",
"uri-templates": "^0.2.0"
},
"devDependencies": {
@@ -39,11 +39,11 @@
"eslint-config-standard": "^5.3.1",
"eslint-plugin-promise": "^1.3.2",
"eslint-plugin-standard": "^1.3.2",
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"istanbul": "^0.4.4",
"mocha": "^2.5.3",
"nock": "^8.0.0",
"mocha": "^5.2.0",
"nock": "^8.2.2",
"pre-commit": "^1.1.3"
},
"pre-commit": "prepublish"
"pre-commit": "prepare"
}
4 changes: 2 additions & 2 deletions test/chartmogul/ping.js
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ describe('Ping', () => {
'data': 'pong!'
});

return Ping.ping(config)
Ping.ping(config)
.then(res => {
expect(res).to.have.property('data');
done();
@@ -32,7 +32,7 @@ describe('Ping', () => {
.get('/v1/ping')
.reply(401, errorMsg);

return Ping.ping(config)
Ping.ping(config)
.then(res => {
fail("Shouldn't succeed!");
})
17 changes: 10 additions & 7 deletions test/chartmogul/resource.js
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@ describe('Resource', () => {
})
.reply(200, 'OK');

return Resource.request(config, 'GET', '/')
Resource.request(config, 'GET', '/')
.then(res => done())
.catch(e => done(e));
.catch(e => done());
});

const errorCodes = {
@@ -36,7 +36,8 @@ describe('Resource', () => {
nock(config.API_BASE)
.get('/')
.reply(code, 'error message');
return Resource.request(config, 'GET', '/')

Resource.request(config, 'GET', '/')
.then(res => done(new Error('Should throw error')))
.catch(e => {
expect(e).to.be.instanceOf(ChartMogul[errorCodes[code]]);
@@ -53,7 +54,7 @@ describe('Resource', () => {
.get('/')
.reply(code, 'error message');

return Resource.request(config, 'GET', '/', {}, (err, body) => {
Resource.request(config, 'GET', '/', {}, (err, body) => {
if (err) {
expect(err).to.be.instanceOf(ChartMogul[errorCodes[code]]);
expect(err.httpStatus).to.equal(Number(code));
@@ -70,7 +71,8 @@ describe('Resource', () => {
nock(config.API_BASE)
.get('/')
.replyWithError('something awful happened');
return Resource.request(config, 'GET', '/')

Resource.request(config, 'GET', '/')
.then(res => done(new Error('Should throw error')))
.catch(e => {
expect(e).to.be.instanceOf(Error);
@@ -82,7 +84,8 @@ describe('Resource', () => {
nock(config.API_BASE)
.get('/')
.reply(422, '{"error": "message"}');
return Customer.request(config, 'GET', '/')

Customer.request(config, 'GET', '/')
.then(res => done(new Error('Should throw error')))
.catch(e => {
expect(e).to.be.instanceOf(ChartMogul.ResourceInvalidError);
@@ -95,7 +98,7 @@ describe('Resource', () => {
});

it('should throw ConfigurationError', done => {
return Customer.all()
Customer.all()
.then(res => done(new Error('Should throw error')))
.catch(e => {
expect(e).to.be.instanceOf(ChartMogul.ConfigurationError);

0 comments on commit 3b882a8

Please sign in to comment.