Comparing version 1.2.1 to 2.0.0
{ | ||
"name": "bip", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "Get balance of bip card (Chile)", | ||
"main": "lib", | ||
"main": "src", | ||
"scripts": { | ||
"prepublish": "npm run build -s", | ||
"prebuild": "npm run lint -s && npm run clean -s", | ||
"build": "babel src --out-dir lib --source-maps", | ||
"lint": "eslint src", | ||
"clean": "rimraf lib", | ||
"pretest": "npm run build -s", | ||
"test": "mocha --compilers js:babel-core/register" | ||
"pretest": "eslint src", | ||
"test": "istanbul cover _mocha", | ||
"coveralls": "coveralls < coverage/lcov.info" | ||
}, | ||
"engines": { | ||
"node": ">=0.12" | ||
"node": ">=4" | ||
}, | ||
@@ -34,17 +30,20 @@ "repository": { | ||
"dependencies": { | ||
"moment": "^2.11.0", | ||
"q": "^1.4.1", | ||
"request-promise": "^1.0.2" | ||
"moment": "^2.13.0", | ||
"request-promise": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.3.17", | ||
"babel-core": "^6.3.26", | ||
"babel-preset-es2015": "^6.3.13", | ||
"chai": "^3.4.1", | ||
"eslint": "^1.10.3", | ||
"mocha": "^2.3.4", | ||
"nock": "^3.6.0", | ||
"rimraf": "^2.5.0" | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.11.9", | ||
"eslint": "^2.9.0", | ||
"istanbul": "^0.4.3", | ||
"mocha": "^2.4.5", | ||
"nock": "^8.0.0" | ||
}, | ||
"eslintConfig": { | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
@@ -55,2 +54,6 @@ "indent": [ | ||
], | ||
"linebreak-style": [ | ||
2, | ||
"unix" | ||
], | ||
"quotes": [ | ||
@@ -60,6 +63,2 @@ 2, | ||
], | ||
"linebreak-style": [ | ||
2, | ||
"unix" | ||
], | ||
"semi": [ | ||
@@ -69,19 +68,5 @@ 2, | ||
] | ||
}, | ||
"ecmaFeatures": { | ||
"modules": true | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"extends": "eslint:recommended" | ||
} | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
] | ||
}, | ||
"tonicExampleFilename": "example.js" | ||
} |
@@ -6,2 +6,3 @@ # bip | ||
[![Build Status](https://img.shields.io/travis/lgaticaq/bip.svg?style=flat-square)](https://travis-ci.org/lgaticaq/bip) | ||
[![Coverage Status](https://img.shields.io/coveralls/lgaticaq/bip/master.svg?style=flat-square)](https://coveralls.io/github/lgaticaq/bip?branch=master) | ||
[![dependency Status](https://img.shields.io/david/lgaticaq/bip.svg?style=flat-square)](https://david-dm.org/lgaticaq/bip#info=dependencies) | ||
@@ -27,14 +28,6 @@ [![devDependency Status](https://img.shields.io/david/dev/lgaticaq/bip.svg?style=flat-square)](https://david-dm.org/lgaticaq/bip#info=devDependencies) | ||
// Promise | ||
bip(number) | ||
.then(data => console.log(data)) | ||
.fail(err => console.error(err)); | ||
.then(console.log) | ||
.catch(console.error); | ||
// Callback | ||
bip(number, (err, data) => { | ||
if (err) return console.error(err); | ||
console.log(data); | ||
}); | ||
``` | ||
Result: | ||
@@ -41,0 +34,0 @@ |
'use strict'; | ||
import {expect} from 'chai'; | ||
import nock from 'nock'; | ||
const {expect} = require('chai'); | ||
const nock = require('nock'); | ||
import lib from '../lib'; | ||
const lib = require('../src'); | ||
@@ -33,28 +33,13 @@ describe('bip', () => { | ||
it('should return a balance data (callback)', (done) => { | ||
lib(number, (err, data) => { | ||
expect(err).to.be.null; | ||
expect(data).to.be.a('object'); | ||
it('should return a balance data', done => { | ||
lib(number).then(data => { | ||
expect(data.number).to.eql(number); | ||
expect(data.balance).to.be.a('number'); | ||
expect(data.date).to.be.a('date'); | ||
expect(data.message).to.be.a('string'); | ||
expect(data.valid).to.be.a('boolean'); | ||
expect(data.balance).to.eql(1180); | ||
expect(data.date).to.eql(new Date('2016-01-02T23:59:00.000Z')); | ||
expect(data.message).to.eql('Tarjeta Valida'); | ||
expect(data.valid).to.be.true; | ||
done(); | ||
}); | ||
}); | ||
it('should return a balance data (promise)', (done) => { | ||
lib(number).then((data) => { | ||
expect(data).to.be.a('object'); | ||
expect(data.number).to.eql(number); | ||
expect(data.balance).to.be.a('number'); | ||
expect(data.date).to.be.a('date'); | ||
expect(data.message).to.be.a('string'); | ||
expect(data.valid).to.be.a('boolean'); | ||
}).catch(err => { | ||
expect(err).to.be.undefined; | ||
done(); | ||
}).fail((err) => { | ||
expect(err).to.be.null; | ||
done(); | ||
}); | ||
@@ -84,29 +69,9 @@ }); | ||
it('should return a empty data (callback)', (done) => { | ||
lib(number, (err, data) => { | ||
expect(err).to.be.null; | ||
expect(data).to.be.a('object'); | ||
expect(data.number).to.eql(number); | ||
expect(data.balance).to.eql(0); | ||
expect(data.date).to.eql(null); | ||
expect(data.message).to.be.a('string'); | ||
expect(data.valid).to.eql(false); | ||
it('should return a empty data', done => { | ||
lib(number).catch((err) => { | ||
expect(err.message).to.eql('Esta tarjeta no se puede cargar'); | ||
done(); | ||
}); | ||
}); | ||
it('should return a empty data (promise)', (done) => { | ||
lib(number).then((data) => { | ||
expect(data.number).to.eql(number); | ||
expect(data.balance).to.eql(0); | ||
expect(data.date).to.eql(null); | ||
expect(data.message).to.be.a('string'); | ||
expect(data.valid).to.eql(false); | ||
done(); | ||
}).fail((err) => { | ||
expect(err).to.be.null; | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
48955
2
6
20
503
42
1
+ Addedbluebird@3.7.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedrequest-promise@3.0.0(transitive)
- Removedq@^1.4.1
- Removedbluebird@2.11.0(transitive)
- Removedcls-bluebird@1.1.3(transitive)
- Removedis-bluebird@1.0.2(transitive)
- Removedlodash@3.10.1(transitive)
- Removedq@1.5.1(transitive)
- Removedrequest-promise@1.0.2(transitive)
- Removedshimmer@1.2.1(transitive)
Updatedmoment@^2.13.0
Updatedrequest-promise@^3.0.0