Skip to content

Commit

Permalink
Update to pitneyBowes test
Browse files Browse the repository at this point in the history
  • Loading branch information
antman10001 committed Jul 18, 2019
1 parent 7120fcf commit af947f2
Showing 1 changed file with 53 additions and 34 deletions.
87 changes: 53 additions & 34 deletions test/carriers/pitneyBowes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const assert = require('assert');
const Bloodhound = require('../../index.js');

describe('Newgistics', function() {
this.timeout(10000);
this.timeout(20000);

it('should return an error for invalid base URL', function(done) {
const bloodhound = new Bloodhound({
Expand All @@ -19,87 +19,107 @@ describe('Newgistics', function() {
});
});

it('4206336792748927005269000010615207', function(done) {
it('4204540992748927005269000020006828', function(done) {
const bloodhound = new Bloodhound({
pitneyBowes: {
api_key: process.env.PITNEY_BOWES_API_KEY,
api_secret: process.env.PITNEY_BOWES_API_SECRET
}
});

bloodhound.track('4206336792748927005269000010615207', 'newgistics', function(err, actual) {
bloodhound.track('4204540992748927005269000020006828', 'newgistics', function(err, actual) {
assert.ifError(err);

const expected = {
events: [
{
address: {
city: 'Lake Saint Louis',
city: 'Dayton',
country: null,
state: 'MO',
state: 'OH',
zip: null
},
date: new Date('2019-03-28T18:35:00.000Z'),
description: 'Delivered, In/At Mailbox'
date: new Date('2019-06-22T14:59:00.000Z'),
description: 'Moved, Left no Address'
},
{
address: {
city: 'Lake Saint Louis',
city: 'Dayton',
country: null,
state: 'MO',
state: 'OH',
zip: null
},
date: new Date('2019-03-28T14:19:00.000Z'),
description: 'Out for Delivery'
date: new Date('2019-06-22T14:59:00.000Z'),
description: 'Return to Sender Processed'
},
{
address: {
city: 'Lake Saint Louis',
city: 'Dayton',
country: null,
state: 'MO',
state: 'OH',
zip: null
},
date: new Date('2019-03-28T14:09:00.000Z'),
description: 'Sorting Complete'
date: new Date('2019-06-21T20:47:00.000Z'),
description: 'No Such Number'
},
{
address: {
city: 'O FALLON',
city: 'Dayton',
country: null,
state: 'MO',
state: 'OH',
zip: null
},
date: new Date('2019-03-27T16:21:00.000Z'),
description: 'Arrived at Post Office'
date: new Date('2019-06-21T14:33:00.000Z'),
description: 'Moved, Left no Address'
},
{
address: {
city: 'Dayton',
country: null,
state: 'OH',
zip: null
},
date: new Date('2019-06-21T12:14:00.000Z'),
description: 'Out for Delivery'
},
{
address: {
city: 'O FALLON',
city: 'Dayton',
country: null,
state: 'MO',
state: 'OH',
zip: null
},
date: new Date('2019-03-27T15:06:00.000Z'),
description: 'Accepted at USPS Destination Facility'
date: new Date('2019-06-21T12:04:00.000Z'),
description: 'Sorting Complete'
},
{
address: {
city: 'Dayton',
country: null,
state: 'OH',
zip: null
},
date: new Date('2019-06-20T15:26:00.000Z'),
description: 'Arrived at Post Office'
},
{
address: {
city: 'Greenwood',
city: 'Hebron',
country: null,
state: 'IN',
state: 'KY',
zip: null
},
date: new Date('2019-03-22T20:05:00.000Z'),
date: new Date('2019-06-20T05:44:00.000Z'),
description: 'Departed Shipping Partner Facility, USPS Awaiting Item'
},
{
address: {
city: 'Greenwood',
city: 'Hebron',
country: null,
state: 'IN',
state: 'KY',
zip: null
},
date: new Date('2019-03-22T15:39:00.000Z'),
date: new Date('2019-06-19T18:12:00.000Z'),
description: 'Arrived Shipping Partner Facility, USPS Awaiting Item'
},
{
Expand All @@ -109,7 +129,7 @@ describe('Newgistics', function() {
state: 'TX',
zip: null
},
date: new Date('2019-03-21T22:16:00.000Z'),
date: new Date('2019-06-18T23:24:00.000Z'),
description: 'Departed Shipping Partner Facility, USPS Awaiting Item'
},
{
Expand All @@ -119,7 +139,7 @@ describe('Newgistics', function() {
state: 'TX',
zip: null
},
date: new Date('2019-03-21T13:18:00.000Z'),
date: new Date('2019-06-18T14:44:00.000Z'),
description: 'Arrived Shipping Partner Facility, USPS Awaiting Item'
},
{
Expand All @@ -129,12 +149,11 @@ describe('Newgistics', function() {
state: 'TX',
zip: null
},
date: new Date('2019-03-18T16:06:00.000Z'),
date: new Date('2019-06-17T12:07:00.000Z'),
description: 'Picked Up by Shipping Partner, USPS Awaiting Item'
}
],
deliveredAt: new Date('2019-03-28T18:35:00.000Z'),
shippedAt: new Date('2019-03-21T13:18:00.000Z')
shippedAt: new Date('2019-06-18T14:44:00.000Z')
};

assert.deepStrictEqual(actual, expected);
Expand Down

0 comments on commit af947f2

Please sign in to comment.