forked from ddo/oauth-1.0a
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ddo#59
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,8 @@ | |
"istanbul": "^0.4.5", | ||
"mocha": "^4.0.1", | ||
"request": "~2.33.0" | ||
}, | ||
"dependencies": { | ||
"whatwg-url": "^6.4.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var expect = require('chai').expect; | ||
var OAuth = require('../oauth-1.0a'); | ||
|
||
describe('#getBaseUrl', function() { | ||
var oauth = new OAuth({ | ||
consumer: {} | ||
}); | ||
|
||
beforeEach(function () { | ||
oauth = new OAuth({ | ||
consumer: {} | ||
}); | ||
}); | ||
|
||
it('should return base url', function () { | ||
expect(oauth.getBaseUrl('http://example.com/path/')).to.equal('http://example.com/path/'); | ||
expect(oauth.getBaseUrl('http://example.com/path/?foo=bar')).to.equal('http://example.com/path/'); | ||
}); | ||
|
||
it('should exclude default port number', function () { | ||
expect(oauth.getBaseUrl('http://example.com/')).to.equal('http://example.com/'); | ||
expect(oauth.getBaseUrl('http://example.com:80/')).to.equal('http://example.com/'); | ||
expect(oauth.getBaseUrl('https://example.com/')).to.equal('https://example.com/'); | ||
expect(oauth.getBaseUrl('https://example.com:443/')).to.equal('https://example.com/'); | ||
}); | ||
|
||
it('should include non-default port number', function () { | ||
expect(oauth.getBaseUrl('http://example.com:8080/')).to.equal('http://example.com:8080/'); | ||
expect(oauth.getBaseUrl('http://example.com:443/')).to.equal('http://example.com:443/'); | ||
expect(oauth.getBaseUrl('https://example.com:8080/')).to.equal('https://example.com:8080/'); | ||
expect(oauth.getBaseUrl('https://example.com:80/')).to.equal('https://example.com:80/'); | ||
}); | ||
}); |