This module is still very experimental. Use at your own risk since the API will likely change before v1.0.
This example demonstrates publishing a message to a rabbit connection and verifying that a different message was produced by the system under test.
var connection = require('./rabbit-connection.js');
var bucky = require('bucky');
bucky(connection)
.produce({
exchange: 'data',
routingKey: 'user',
contentType: 'application/json',
payload: {
id: '1a2b3c',
name: 'John Doe'
}
})
.expect({
exchange: 'emails',
routingKey: 'newUserRegistration',
contentType: 'application/json',
payload: {
name: 'John Doe',
greeting: 'Hola!'
}
})
.end(function (err) {
if (err) { throw err; }
console.log('Success!');
});
Bucky is inspired by supertest. Rather than use something unoriginal like superrabbit
, it made sense to name the module after superhero rabbit Bucky O'Hare.