'use strict';
var amqp = require('amqp10'),
    BrokerAgent = require('../lib/broker-agent'),
    config = require('./config'),
    expect = require('chai').expect;

var test = {};
describe('Broker', () => {
  before(() => {
    test.client = new amqp.Client();
    return test.client.connect(config.address)
      .then(() => {
        test.agent = new BrokerAgent(test.client);
        return test.agent.initialize();
      });
  });

  it('should support an echo command', () => {
    return test.agent.getAllBrokers()
      .then((brokers) => brokers.map(broker => broker.echo({ sequence: 0, body: 'test' })))
      .map(response => {
        expect(response).to.eql({ sequence: 0, body: 'test' });
      });
  });
});

'use strict';
var amqp = require('amqp10'),
    BrokerAgent = require('../lib/broker-agent'),
    config = require('./config'),
    expect = require('chai').expect;

var test = {};
describe('Broker', function() {
  before(function() {
    test.client = new amqp.Client();
    return test.client.connect(config.address)
      .then(function() {
        test.agent = new BrokerAgent(test.client);
        return test.agent.initialize();
      });
  });

  it('should support an echo command', function() {
    return test.agent.getAllBrokers()
      .map(function(broker) { return broker.echo({ sequence: 0, body: 'test' }); })
      .map(function(response) { expect(response).to.eql({ sequence: 0, body: 'test' }); });
  });
});

fix test to use 0.12 compatible syntax