Skip to content

Commit

Permalink
Merge 8e062ee into 38ee9f3
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmwhitehead committed Jul 19, 2019
2 parents 38ee9f3 + 8e062ee commit 6ada8ca
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 11 deletions.
1 change: 1 addition & 0 deletions carriers/dhl.js
Expand Up @@ -72,6 +72,7 @@ function DHL() {
}

const results = {
carrier: 'DHL',
events: []
};

Expand Down
1 change: 1 addition & 0 deletions carriers/fedEx.js
Expand Up @@ -100,6 +100,7 @@ function FedEx(options) {
}

const results = {
carrier: 'FedEx',
events: []
};

Expand Down
1 change: 1 addition & 0 deletions carriers/pitneyBowes.js
Expand Up @@ -25,6 +25,7 @@ function PitneyBowes(options) {
}

const results = {
carrier: 'Newgistics',
events: []
};

Expand Down
1 change: 1 addition & 0 deletions carriers/ups.js
Expand Up @@ -101,6 +101,7 @@ function UPS(options) {
});
}, function(err, body) {
const results = {
carrier: 'UPS',
events: []
};

Expand Down
1 change: 1 addition & 0 deletions carriers/usps.js
Expand Up @@ -73,6 +73,7 @@ function USPS(options) {

parser.parseString(res.body, function(err, data) {
const results = {
carrier: 'USPS',
events: []
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -38,5 +38,5 @@
"type": "git",
"url": "https://github.com/mediocre/bloodhound.git"
},
"version": "0.7.0"
"version": "0.8.0"
}
19 changes: 10 additions & 9 deletions test/carriers/dhl.js
Expand Up @@ -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 = [
Expand Down Expand Up @@ -37,15 +37,15 @@ 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`);
}
});
});

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`);
Expand All @@ -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: {
Expand Down
29 changes: 28 additions & 1 deletion test/carriers/fedEx.js
Expand Up @@ -54,6 +54,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2013-12-30T18:24:00.000Z'),
Expand All @@ -79,6 +80,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-04T00:54:00.000Z'),
Expand Down Expand Up @@ -115,6 +117,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-03T22:58:00.000Z'),
Expand All @@ -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();
Expand All @@ -152,6 +157,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-07T11:07:00.000Z'),
Expand Down Expand Up @@ -228,6 +234,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-08T02:37:00.000Z'),
Expand Down Expand Up @@ -284,6 +291,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-07T10:11:05.000Z'),
Expand Down Expand Up @@ -330,6 +338,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-04T11:55:00.000Z'),
Expand Down Expand Up @@ -446,6 +455,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-02-06T07:53:00.000Z'),
Expand Down Expand Up @@ -552,6 +562,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2013-12-18T19:22:15.000Z'),
Expand Down Expand Up @@ -659,6 +670,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2013-12-24T00:29:46.000Z'),
Expand Down Expand Up @@ -777,6 +789,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-14T15:45:00.000Z'),
Expand Down Expand Up @@ -874,6 +887,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-28T23:43:08.000Z'),
Expand Down Expand Up @@ -963,6 +977,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-15T14:32:31.000Z'),
Expand Down Expand Up @@ -1110,6 +1125,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-02-06T20:21:00.000Z'),
Expand Down Expand Up @@ -1229,6 +1245,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-09T18:31:00.000Z'),
Expand Down Expand Up @@ -1347,6 +1364,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-08T23:23:00.000Z'),
Expand Down Expand Up @@ -1540,6 +1558,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2014-01-03T00:45:00.000Z'),
Expand Down Expand Up @@ -1577,6 +1596,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2015-03-02T11:16:40.000Z'),
Expand All @@ -1602,6 +1622,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2015-03-03T15:57:12.000Z'),
Expand Down Expand Up @@ -1658,6 +1679,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2015-03-04T15:28:00.000Z'),
Expand Down Expand Up @@ -1737,6 +1759,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2015-03-06T18:51:00.000Z'),
Expand Down Expand Up @@ -1862,6 +1885,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [],
url: 'https://www.fedex.com/apps/fedextrack/?tracknumbers=2873008051'
};
Expand All @@ -1876,6 +1900,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2015-03-21T02:12:00.000Z'),
Expand Down Expand Up @@ -1912,6 +1937,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2015-03-01T20:37:39.000Z'),
Expand Down Expand Up @@ -1980,6 +2006,7 @@ describe('FedEx', function() {
assert.ifError(err);

const expected = {
carrier: 'FedEx',
events: [
{
date: new Date('2015-03-02T17:25:25.000Z'),
Expand Down
1 change: 1 addition & 0 deletions test/carriers/pitneyBowes.js
Expand Up @@ -31,6 +31,7 @@ describe('Newgistics', function() {
assert.ifError(err);

const expected = {
carrier: 'Newgistics',
events: [
{
address: {
Expand Down

0 comments on commit 6ada8ca

Please sign in to comment.