{"size": 1184, "ext": "js", "max_stars_repo_path": "spec/integration/connection.spec.js", "max_stars_repo_name": "standuply/rabbot", "max_stars_repo_stars_event_min_datetime": "2019-12-09T20:50:10.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T07:36:58.000Z", "max_issues_repo_path": "spec/integration/connection.spec.js", "max_issues_repo_name": "standuply/rabbot", "max_issues_repo_issues_event_min_datetime": "2019-12-08T23:14:42.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-14T14:59:22.000Z", "max_forks_repo_path": "spec/integration/connection.spec.js", "max_forks_repo_name": "zlintz/foo-foo-mq", "max_forks_repo_forks_event_min_datetime": "2020-04-22T22:59:53.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-21T16:01:34.000Z"}
{"max_stars_count": 35, "max_issues_count": 21, "max_forks_count": 11, "avg_line_length": 26.9090909091, "max_line_length": 117, "alphanum_fraction": 0.5810810811}
require('../setup');
const rabbit = require('../../src/index.js');
const config = require('./configuration');

describe('Connection', function () {
  describe('on connection', function () {
    let connected;
    before(function (done) {
      rabbit.once('connected', (c) => {
        connected = c;
        done();
      });
      rabbit.configure({ connection: config.connection });
    });

    it('should assign uri to connection', function () {
      connected.uri.should.equal('amqp://guest:guest@127.0.0.1:5672/%2f?heartbeat=30');
    });

    after(function () {
      return rabbit.close('default');
    });
  });

  describe('on connection using uri', function () {
    let connected;
    before(function (done) {
      rabbit.once('connected', (c) => {
        connected = c;
        done();
      });
      rabbit.addConnection({ name: 'connectionWithUri', uri: 'amqp://guest:guest@127.0.0.1:5672/%2f?heartbeat=11' });
    });

    it('should assign uri to connection', function () {
      connected.uri.should.equal('amqp://guest:guest@127.0.0.1:5672/%2f?heartbeat=11');
    });

    after(function () {
      return rabbit.close('connectionWithUri');
    });
  });
});
