Navigation Menu

Skip to content

Commit

Permalink
Add tests for getSearchEndpoint() and getDocumentsEndPoint()
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 22, 2012
1 parent 245c445 commit 6c722c5
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/database-domain.test.js
Expand Up @@ -194,6 +194,50 @@ suite('database', function() {
});
});

suite('getDocumentsEndpoint', function() {
var domain;
setup(function() {
domain = new Domain('valid').setId(Domain.DEFAULT_ID);
});

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

test('IP address', 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() {
assert.equal(domain.getDocumentsEndpoint('localhost:4567'),
'doc-valid-' + Domain.DEFAULT_ID + '.127.0.0.1.xip.io:4567');
});
});

suite('getSearchEndpoint', function() {
var domain;
setup(function() {
domain = new Domain('valid').setId(Domain.DEFAULT_ID);
});

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

test('IP address', 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() {
assert.equal(domain.getSearchEndpoint('localhost:4567'),
'search-valid-' + Domain.DEFAULT_ID + '.127.0.0.1.xip.io:4567');
});
});

suite('getting data from database', function() {
var temporaryDatabase;
var context;
Expand Down

0 comments on commit 6c722c5

Please sign in to comment.