Giter Club home page Giter Club logo

amqplib-mocks's Introduction

amqplib-mocks

NPM Version Build Coverage

A simple mocking framework for amqplib. Currently supports the following:

  • Multiple connections
  • Routing messages based on routingKey
  • Retrieving any published messages on a channel
  • Asserting topology
  • The server remotely closing a channel

Usage

const amqplib = require( "amqplib-mocks" );
const proxyquire = require( "proxyquire" );

const server = proxyquire( "./app", { amqplib } );
server.listen();

amqplib-mocks's People

Contributors

bunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

amqplib-mocks's Issues

assertQueue does not generate a queueName for transient queues.

When you assert a queue without a name it should generate one for you ( eg: amq.gen-E3xHFQaudCxqPnW8jMMvjQ). These are normally used for transient queues which die with the channel.

eg

const {queue} = channel.assertQueue('', {exclusive: true}); // queue = <autoGen name>

https://github.com/squaremo/amqp.node/blob/master/examples/tutorials/receive_logs_topic.js#L21

Currently the assertQueue simply tracks the queues blank name which in turn means no messages get routed to it.

Create table of which functions is mocked

Create a table of what functions is mocked and step by step mock them.

connect
connection.close
connection.createChannel
connection.createConfirmChannel
events

Channel
channel.close
events
channel.assertQueue
channel.checkQueue
channel.deleteQueue
channel.purgeQueue
channel.bindQueue
channel.unbindQueue
channel.assertExchange
channel.checkExchange
channel.deleteExchange
channel.bindExchange
channel.unbindExchange
channel.publish
channel.sendToQueue
channel.consume
channel.cancel
channel.get
channel.ack
channel.ackAll
channel.nack
channel.nackAll
channel.reject
channel.prefetch
channel.recover

ConfirmChannel
confirmChannel.publish
confirmChannel.sendToQueue
confirmChannel.waitForConfirms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.