UNPKG

dl

Version:

DreamLab Libs

49 lines (35 loc) 1.75 kB
describe('GetFunctionDataMethod', function () { it('require', function () { var GetFunctionDataMethod = null; expect(function () { GetFunctionDataMethod = require('../../lib/jsonrpc/GetFunctionDataMethod.js').GetFunctionDataMethod; }).not.toThrow(); expect(GetFunctionDataMethod).toBeDefined(); }); it('creation', function () { var getFunctionDataMethod = null; var GetFunctionDataMethod = require('../../lib/jsonrpc/GetFunctionDataMethod.js').GetFunctionDataMethod; expect(function () { getFunctionDataMethod = new GetFunctionDataMethod(); }).not.toThrow(); expect(getFunctionDataMethod instanceof GetFunctionDataMethod).toBeTruthy(); }); it('execute', function () { var GetFunctionDataMethod = require('../../lib/jsonrpc/GetFunctionDataMethod.js').GetFunctionDataMethod; var JsonRpcMethod = require('core').jsonrpc.JsonRpcMethod; var event = null; var getFunctionDataMethod = new GetFunctionDataMethod(); getFunctionDataMethod.addEventListener(JsonRpcMethod.Event.OK, function (e) { event = e; }); getFunctionDataMethod.execute(); waitsFor(function () { return event; }, "GetFunctionDataMethod never emitted JsonRpcMethod.Event.OK", 1000); runs(function () { expect(event).toBeTruthy(); expect(event.type).toBe(JsonRpcMethod.Event.OK); expect(event.data).toEqual({ data : { sysparams : [ ], params : [ ], description : 'NOT_IMPLEMENTED' } }); }); }); });