Navigation Menu

Skip to content

Commit

Permalink
Add tests for getSearchEndpoint about hostnames without port number
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 23, 2012
1 parent ee30948 commit 28766b7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions test/database-domain.test.js
Expand Up @@ -237,20 +237,35 @@ suite('database', function() {
domain = new Domain('valid').setId(Domain.DEFAULT_ID);
});

test('regular domain', function() {
test('regular domain, with port', function() {
assert.equal(domain.getSearchEndpoint('my.domain:0123'),
'search-valid-' + Domain.DEFAULT_ID + '.my.domain:0123');
});

test('IP address', function() {
test('regular domain, without port', function() {
assert.equal(domain.getSearchEndpoint('my.domain'),
'search-valid-' + Domain.DEFAULT_ID + '.my.domain');
});

test('IP address, with port', function() {
assert.equal(domain.getSearchEndpoint('192.168.0.1:4567'),
'search-valid-' + Domain.DEFAULT_ID + '.192.168.0.1.xip.io:4567');
});

test('localhost', function() {
test('IP address, without port', function() {
assert.equal(domain.getSearchEndpoint('192.168.0.1'),
'search-valid-' + Domain.DEFAULT_ID + '.192.168.0.1.xip.io');
});

test('localhost, with port', function() {
assert.equal(domain.getSearchEndpoint('localhost:4567'),
'search-valid-' + Domain.DEFAULT_ID + '.127.0.0.1.xip.io:4567');
});

test('localhost, without port', function() {
assert.equal(domain.getSearchEndpoint('localhost'),
'search-valid-' + Domain.DEFAULT_ID + '.127.0.0.1.xip.io');
});
});

suite('getting data from database', function() {
Expand Down

0 comments on commit 28766b7

Please sign in to comment.