UNPKG

dl

Version:

DreamLab Libs

45 lines (39 loc) 1.24 kB
describe('QueueHostPreferrer', function () { var QueuePreferred = null; it('require', function () { expect(function () { QueuePreferred = require('../../lib/queue/QueueHostPreferrer.js').QueueHostPreferrer; }).not.toThrow(); expect(QueuePreferred).toBeTruthy(); }); it('create QueueHostPreferrer', function () { var application = null; expect(function () { application = new QueuePreferred(); }).not.toThrow(); expect(application).toBeTruthy(); }); it('Parse prefered hosts', function (done) { var hostsToParse = [{ host : '127.0.0.1', port : 1234 }]; var application = null; var data = { 'localhost' : 2 }; var expected = [{ host : '127.0.0.1', port : 1234, weight: 2 }]; expect(function () { application = new QueuePreferred(); application.setHosts(data); application.parseHosts(hostsToParse, function(err, hosts) { expect(hosts).toEqual(expected) done(); }); }).not.toThrow(); }); });