Navigation Menu

Skip to content

Commit

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

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

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

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

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

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

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

Expand Down

0 comments on commit a01a9ff

Please sign in to comment.