diff --git a/carriers/dhl.js b/carriers/dhl.js index e625c73..a1c1141 100644 --- a/carriers/dhl.js +++ b/carriers/dhl.js @@ -72,6 +72,7 @@ function DHL() { } const results = { + carrier: 'DHL', events: [] }; diff --git a/carriers/fedEx.js b/carriers/fedEx.js index 2923fd6..ccacabf 100644 --- a/carriers/fedEx.js +++ b/carriers/fedEx.js @@ -100,6 +100,7 @@ function FedEx(options) { } const results = { + carrier: 'FedEx', events: [] }; diff --git a/carriers/pitneyBowes.js b/carriers/pitneyBowes.js index dd616bb..c3f69a8 100644 --- a/carriers/pitneyBowes.js +++ b/carriers/pitneyBowes.js @@ -25,6 +25,7 @@ function PitneyBowes(options) { } const results = { + carrier: 'Newgistics', events: [] }; diff --git a/carriers/ups.js b/carriers/ups.js index ecc9141..6f8d2fd 100644 --- a/carriers/ups.js +++ b/carriers/ups.js @@ -101,6 +101,7 @@ function UPS(options) { }); }, function(err, body) { const results = { + carrier: 'UPS', events: [] }; diff --git a/carriers/usps.js b/carriers/usps.js index 98ddf34..63efd6f 100644 --- a/carriers/usps.js +++ b/carriers/usps.js @@ -73,6 +73,7 @@ function USPS(options) { parser.parseString(res.body, function(err, data) { const results = { + carrier: 'USPS', events: [] }; diff --git a/package.json b/package.json index ab8075a..5b9fe21 100644 --- a/package.json +++ b/package.json @@ -38,5 +38,5 @@ "type": "git", "url": "https://github.com/mediocre/bloodhound.git" }, - "version": "0.7.0" + "version": "0.8.0" } diff --git a/test/carriers/dhl.js b/test/carriers/dhl.js index 2d5a6c3..e395c6f 100644 --- a/test/carriers/dhl.js +++ b/test/carriers/dhl.js @@ -3,8 +3,8 @@ const assert = require('assert'); const Bloodhound = require('../../index'); const DHL = require('../../carriers/dhl'); -describe('DHL', function () { - describe('dhl.isTrackingNumberValid', function () { +describe('DHL', function() { + describe('dhl.isTrackingNumberValid', function() { const dhl = new DHL(); const validTrackingNumbers = [ @@ -37,7 +37,7 @@ describe('DHL', function () { ]; - it('should detect valid DHL tracking numbers', function () { + it('should detect valid DHL tracking numbers', function() { validTrackingNumbers.forEach(trackingNumber => { if (!dhl.isTrackingNumberValid(trackingNumber)) { assert.fail(`${trackingNumber} is not recognized as a valid DHL tracking number`); @@ -45,7 +45,7 @@ describe('DHL', function () { }); }); - it('should not detect invalid DHL tracking numbers', function () { + it('should not detect invalid DHL tracking numbers', function() { invalidTrackingNumbers.forEach(trackingNumber => { if (dhl.isTrackingNumberValid(trackingNumber)) { assert.fail(`${trackingNumber} should not be recognized as a valid DHL tracking number`); @@ -55,23 +55,24 @@ describe('DHL', function () { }); }); -describe('dhl.track', function () { +describe('dhl.track', function() { this.timeout(10000); const bloodhound = new Bloodhound(); - it.skip('should return a valid response with no errors', function (done) { - bloodhound.track('9374869903503911996586', 'dhl', function (err) { + it.skip('should return a valid response with no errors', function(done) { + bloodhound.track('9374869903503911996586', 'dhl', function(err) { assert.ifError(err); done(); }) }); - it.skip('Delivered', function (done) { - bloodhound.track('9374869903503912434773', 'dhl', function (err, actual) { + it.skip('Delivered', function(done) { + bloodhound.track('9374869903503912434773', 'dhl', function(err, actual) { assert.ifError(err); const expected = { + carrier: 'DHL', events: [ { address: { diff --git a/test/carriers/fedEx.js b/test/carriers/fedEx.js index cafab44..d5582e1 100644 --- a/test/carriers/fedEx.js +++ b/test/carriers/fedEx.js @@ -54,6 +54,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2013-12-30T18:24:00.000Z'), @@ -79,6 +80,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-04T00:54:00.000Z'), @@ -115,6 +117,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-03T22:58:00.000Z'), @@ -140,7 +143,9 @@ describe('FedEx', function() { bloodhound.track('403934084723025', 'fedex', function(err, actual) { assert.ifError(err); - const expected = {}; + const expected = { + carrier: 'FedEx' + }; assert.deepStrictEqual(actual, expected); done(); @@ -152,6 +157,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-07T11:07:00.000Z'), @@ -228,6 +234,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-08T02:37:00.000Z'), @@ -284,6 +291,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-07T10:11:05.000Z'), @@ -330,6 +338,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-04T11:55:00.000Z'), @@ -446,6 +455,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-02-06T07:53:00.000Z'), @@ -552,6 +562,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2013-12-18T19:22:15.000Z'), @@ -659,6 +670,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2013-12-24T00:29:46.000Z'), @@ -777,6 +789,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-14T15:45:00.000Z'), @@ -874,6 +887,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-28T23:43:08.000Z'), @@ -963,6 +977,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-15T14:32:31.000Z'), @@ -1110,6 +1125,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-02-06T20:21:00.000Z'), @@ -1229,6 +1245,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-09T18:31:00.000Z'), @@ -1347,6 +1364,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-08T23:23:00.000Z'), @@ -1540,6 +1558,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2014-01-03T00:45:00.000Z'), @@ -1577,6 +1596,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2015-03-02T11:16:40.000Z'), @@ -1602,6 +1622,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2015-03-03T15:57:12.000Z'), @@ -1658,6 +1679,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2015-03-04T15:28:00.000Z'), @@ -1737,6 +1759,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2015-03-06T18:51:00.000Z'), @@ -1862,6 +1885,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [], url: 'https://www.fedex.com/apps/fedextrack/?tracknumbers=2873008051' }; @@ -1876,6 +1900,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2015-03-21T02:12:00.000Z'), @@ -1912,6 +1937,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2015-03-01T20:37:39.000Z'), @@ -1980,6 +2006,7 @@ describe('FedEx', function() { assert.ifError(err); const expected = { + carrier: 'FedEx', events: [ { date: new Date('2015-03-02T17:25:25.000Z'), diff --git a/test/carriers/pitneyBowes.js b/test/carriers/pitneyBowes.js index a766df6..b4c0048 100644 --- a/test/carriers/pitneyBowes.js +++ b/test/carriers/pitneyBowes.js @@ -31,6 +31,7 @@ describe('Newgistics', function() { assert.ifError(err); const expected = { + carrier: 'Newgistics', events: [ { address: { diff --git a/test/carriers/ups.js b/test/carriers/ups.js index 2db3876..0fb7990 100644 --- a/test/carriers/ups.js +++ b/test/carriers/ups.js @@ -107,6 +107,7 @@ describe('UPS', function() { it('should return an empty result if there is no tracking information available ', function(done) { bloodhound.track('1Z12345E1505270452', 'ups', function(err, actual) { const expected = { + carrier: 'UPS', events: [] } @@ -128,6 +129,7 @@ describe('UPS', function() { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -246,6 +248,7 @@ describe('UPS', function() { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -280,6 +283,7 @@ describe('UPS', function() { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: {}, @@ -392,6 +396,7 @@ describe('UPS', function() { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -428,6 +433,7 @@ describe('UPS', function() { bloodhound.track('1Z12345E0305271640', 'ups', function(err, actual) { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -467,6 +473,7 @@ describe('UPS', function() { bloodhound.track('1Z12345E1305277940', 'ups', function(err, actual) { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -492,6 +499,7 @@ describe('UPS', function() { bloodhound.track('1Z12345E6205277936', 'ups', function(err, actual) { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -571,6 +579,7 @@ describe('UPS', function() { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -637,6 +646,7 @@ describe('UPS', function() { bloodhound.track('1Z12345E6605272234', 'ups', function(err, actual) { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { @@ -666,6 +676,7 @@ describe('UPS', function() { assert.ifError(err); const expected = { + carrier: 'UPS', events: [ { address: { diff --git a/test/carriers/usps.js b/test/carriers/usps.js index 011fa2c..8aaf979 100644 --- a/test/carriers/usps.js +++ b/test/carriers/usps.js @@ -126,6 +126,7 @@ describe('USPS', function() { it('should return an empty result if there is no tracking information available ', function(done) { bloodhound.track('0987654321234567890', 'usps', function(err, actual) { const expected = { + carrier: 'USPS', events: [] } @@ -147,6 +148,7 @@ describe('USPS', function() { assert.ifError(err); const expected = { + carrier: 'USPS', events: [ { address: {