BonnierNews / exp-fake-amqplib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exp-fake-amqplib

As of 2023-12-15 this project is no longer used, and the repo has been archived.

Build Statusdependencies Status

Mocked version of https://www.npmjs.com/package/amqplib. Currently only supports the callback API.

Overriding amqplib

You might want to override amqplib with exp-fake-amqplib in tests. This can be done this way:

const amqplib = require("amqplib");
const fakeAmqplib = require("exp-fake-amqplib");

amqplib.connect = fakeAmqp.connect;

If you are using version 2 or higher of exp-amqp-connection you can use proxyquire to replace amqplib with exp-fake-amqplib in your tests like this:

const fakeAmqp = require("exp-fake-amqplib");

proxyquire("exp-amqp-connection/bootstrap", {
  "amqplib/callback_api": fakeAmqp
});

About

License:MIT License


Languages

Language:JavaScript 100.0%