UNPKG

mqrpc

Version:

💫 Easy RPC over RabbitMQ

22 lines (21 loc) • 837 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ava_1 = require("ava"); const _config_1 = require("../_config"); const AmqpClient_1 = require("../../lib/AmqpClient"); ava_1.default.beforeEach(async (t) => { t.context.client = new AmqpClient_1.default({ amqpUrl: _config_1.AMQP_URL }); await t.context.client.init(); }); ava_1.default('[unit] #term closes the channel', async (t) => { t.context.client.channel.on('close', () => t.pass()); await t.context.client.term(); }); ava_1.default('[unit] #term closes the connection', async (t) => { t.context.client.connection.on('close', () => t.pass()); await t.context.client.term(); }); ava_1.default('[unit] #term is idempotent', async (t) => { await t.context.client.term(); await t.notThrows(t.context.client.term()); });