Skip to content

Commit

Permalink
[WIP] Exclude default ports 80/443
Browse files Browse the repository at this point in the history
  • Loading branch information
dinoboff committed Dec 21, 2017
1 parent 4dc406a commit 08e3fd8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/getBaseUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 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/');
});
});

0 comments on commit 08e3fd8

Please sign in to comment.