UNPKG

dl

Version:

DreamLab Libs

49 lines (35 loc) 1.58 kB
describe('HealthCheckMethod', function () { it('require', function () { var HealthCheckMethod = null; expect(function () { HealthCheckMethod = require('../../lib/jsonrpc/HealthCheckMethod.js').HealthCheckMethod; }).not.toThrow(); expect(HealthCheckMethod).toBeDefined(); }); it('creation', function () { var healthCheckMethod = null; var HealthCheckMethod = require('../../lib/jsonrpc/HealthCheckMethod.js').HealthCheckMethod; expect(function () { healthCheckMethod = new HealthCheckMethod(); }).not.toThrow(); expect(healthCheckMethod instanceof HealthCheckMethod).toBeTruthy(); }); it('execute', function () { var HealthCheckMethod = require('../../lib/jsonrpc/HealthCheckMethod.js').HealthCheckMethod; var JsonRpcMethod = require('core').jsonrpc.JsonRpcMethod; var event = null; var healthCheckMethod = new HealthCheckMethod(); healthCheckMethod.addEventListener(JsonRpcMethod.Event.OK, function (e) { event = e; }); healthCheckMethod.execute(); waitsFor(function () { return event; }, "HealthCheckMethod never emitted JsonRpcMethod.Event.OK", 1000); runs(function () { expect(event).toBeTruthy(); expect(event.type).toBe(JsonRpcMethod.Event.OK); expect(event.data).toBe("OK"); }); }); });