many tests

This commit is contained in:
Spencer Alger
2013-12-03 19:01:04 -07:00
parent 2ddde47972
commit 4e5f08a29c
19 changed files with 1011 additions and 201 deletions

View File

@ -0,0 +1,32 @@
describe('Nodes to host callback', function () {
var callback = require('../../src/lib/nodes_to_host');
// example node list that would come back from "GET _cluster/nodes"
var nodes = require('../fixtures/short_node_list.json');
it('properly creates host objects', function () {
var hosts = callback(nodes);
hosts.should.have.lengthOf(2);
hosts[0].should.eql({
host: '10.10.10.100',
port: 9205,
_meta: {
id: 'id1',
name: 'Headknocker',
hostname: 'Spencers-MacBook-Pro.local',
version: '0.90.5'
}
});
hosts[1].should.eql({
host: '10.10.10.101',
port: 9205,
_meta: {
id: 'id2',
name: 'Buttknocker',
hostname: 'Johns-MacBook-Pro.local',
version: '0.90.5'
}
});
});
});