Skip to content

Commit

Permalink
Update docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freshlogic committed Jun 8, 2022
1 parent 13396f1 commit e1a9e26
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.9.0] - 2021-06-08
### Chanded
- Updated the DHL API to use https://developer.dhl.com/api-reference/shipment-tracking.

## [1.8.1] - 2021-07-31
### Changed
- Updated the pitney-bowes module to ~0.3.0.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -66,6 +66,9 @@ By default, when Bloodhound encounters a timestamp without a UTC offset it will
const Bloodhound = require('@mediocre/bloodhound');

const bloodhound = new Bloodhound({
dhl: {
apiKey: 'DHL API key from https://developer.dhl.com'
},
fedEx: {
account_number: '123456789',
environment: 'live',
Expand Down Expand Up @@ -100,6 +103,8 @@ bloodhound.track('tracking number', 'FedEx', function(err, data) {
console.log(data);
});
```
**dhl**
The DHL API requires an API key: https://developer.dhl.com.

**fedEx**

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -39,5 +39,5 @@
"type": "git",
"url": "https://github.com/mediocre/bloodhound.git"
},
"version": "1.8.2"
"version": "1.9.0"
}
33 changes: 7 additions & 26 deletions test/carriers/dhl.js
Expand Up @@ -8,33 +8,13 @@ describe('DHL', function() {
const dhl = new DHL();

const validTrackingNumbers = [
'9361269903500576940071',
'9361269903503907020237',
'9361 2699 0350 3907 2657 75',
'9261293148703201610999',
'9261293148703201610975',
'9261 2931 4870 3201 6109 82',
'9474812901015476250258',
'9374869903503907077381',
'9374869903503907060802',
'9374 8699 0350 3906 9887 18',
'9274893148703201609685',
'9274893148703201609715',
'9274 8931 4870 3201 6096 92',
'420941339405511899223428669715',
'420206039405511899223428471196',
'4203 7398 9405 5118 9922 3427 4906 00',
'4204923092748927005269000022418209',
'4209081092748927005269000022418407',
'4200681292612927005269000029934812',
'4209 2155 1234 9505 5000 2071 4300 0001 28'
'420726449361210912400330222910'
];

const invalidTrackingNumbers = [
'9970 4895 0367 429',
'DT771613423732',
'9400 1118 9922 3818 2184 07'

];

it('should detect valid DHL tracking numbers', function() {
Expand All @@ -55,17 +35,18 @@ describe('DHL', function() {
});
});

describe('dhl.track', function() {
describe.skip('dhl.track', function() {
this.timeout(10000);

const bloodhound = new Bloodhound({
usps: {
userId: process.env.USPS_USERID
dhl: {
apiKey: process.env.DHL_API_KEY
}
});

it.skip('should return a valid response with no errors', function(done) {
bloodhound.track('9361269903505749570437', 'dhl', function(err, actual) {
it('should return a valid response with no errors', function(done) {
bloodhound.track('420726449361210912400330222910', 'dhl', function(err, actual) {
console.log(actual);
assert.ifError(err);
done();
});
Expand Down

0 comments on commit e1a9e26

Please sign in to comment.