UNPKG

mqrpc

Version:

💫 Easy RPC over RabbitMQ

16 lines (15 loc) • 609 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ava_1 = require("ava"); const sinon = require("sinon"); const RpcServer_1 = require("../../lib/RpcServer"); ava_1.default('[unit] #register registers a new operation', async (t) => { const server = new RpcServer_1.default({ amqpClient: { amqpUrl: 'fake' } }); const spy = sinon.spy(); server.register('anOp', spy); t.true(server.procedures.has('anOp')); t.is(server.procedures.get('anOp'), spy); const fn = server.procedures.get('anOp'); fn(1, 2, 3); sinon.assert.calledWith(spy, 1, 2, 3); });