Remove connection_id from Connection class
This commit is contained in:
parent
c4d03428e8
commit
b4a68d1a37
|
@ -16,7 +16,6 @@ var Logger = require('./logger'),
|
||||||
// Public: Creates a new Connection
|
// Public: Creates a new Connection
|
||||||
//
|
//
|
||||||
// opts - hash of acceptable params:
|
// opts - hash of acceptable params:
|
||||||
// id - string ID for the connection
|
|
||||||
// robot - Robot the Connection belongs to
|
// robot - Robot the Connection belongs to
|
||||||
// name - name for the connection
|
// name - name for the connection
|
||||||
// adaptor - string module name of the adaptor to be set up
|
// adaptor - string module name of the adaptor to be set up
|
||||||
|
@ -26,13 +25,10 @@ var Logger = require('./logger'),
|
||||||
var Connection = module.exports = function Connection(opts) {
|
var Connection = module.exports = function Connection(opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
opts.id = opts.id || Math.floor(Math.random() * 10000);
|
|
||||||
|
|
||||||
this.connect = this.connect.bind(this);
|
this.connect = this.connect.bind(this);
|
||||||
|
|
||||||
this.robot = opts.robot;
|
this.robot = opts.robot;
|
||||||
this.name = opts.name;
|
this.name = opts.name;
|
||||||
this.connection_id = opts.id;
|
|
||||||
this.port = opts.port;
|
this.port = opts.port;
|
||||||
this.adaptor = this.initAdaptor(opts);
|
this.adaptor = this.initAdaptor(opts);
|
||||||
|
|
||||||
|
@ -49,7 +45,6 @@ Connection.prototype.toJSON = function() {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
port: this.port,
|
port: this.port,
|
||||||
adaptor: this.adaptor.constructor.name || this.adaptor.name,
|
adaptor: this.adaptor.constructor.name || this.adaptor.name,
|
||||||
connection_id: this.connection_id
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,6 @@ describe("Connection", function() {
|
||||||
it("contains the connection's adaptor name", function() {
|
it("contains the connection's adaptor name", function() {
|
||||||
expect(json.adaptor).to.be.eql("Loopback");
|
expect(json.adaptor).to.be.eql("Loopback");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("contains the connection's ID", function() {
|
|
||||||
var id = connection.connection_id;
|
|
||||||
expect(json.connection_id).to.be.eql(id);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#connect", function() {
|
describe("#connect", function() {
|
||||||
|
|
Loading…
Reference in New Issue