Skip to content
This repository was archived by the owner on May 31, 2022. It is now read-only.

Commit d4636bc

Browse files
authored
fix: incorrect connection title on form connections (#349)
1 parent 37bb63d commit d4636bc

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

lib/extended-model.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ const ExtendedConnection = Connection.extend(storageMixin, {
8787
return this.hostname;
8888
}
8989

90-
if (this.hosts && this.hosts.length) {
90+
if (this.hosts && this.hosts.length > 1) {
9191
return this.hosts.map(
9292
({ host, port }) => `${host}:${port}`
9393
).join(',');
9494
}
9595

96-
return this.hostname;
96+
return `${this.hostname}:${this.port}`;
9797
}
9898
}
9999
},

test/model.test.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ describe('Connection', () => {
2222

2323
it('returns hosts if the connection is not srv', () => {
2424
assert.strictEqual(
25-
new Connection({ hosts: [{ host: 'example.com', port: 12345 }] }).title,
26-
'example.com:12345'
25+
new Connection({ hosts: [{
26+
host: 'example.com',
27+
port: 12345
28+
}, {
29+
host: 'example123.com',
30+
port: 123452
31+
}] }).title,
32+
'example.com:12345,example123.com:123452'
2733
);
2834
});
2935

@@ -37,15 +43,16 @@ describe('Connection', () => {
3743
);
3844
});
3945

40-
it('falls back to hostname if nothing else match', () => {
46+
it('falls back to hostname:port if nothing else match', () => {
4147
assert.strictEqual(
4248
new Connection({
4349
isSrvRecord: false,
4450
isFavorite: false,
4551
hosts: [],
46-
hostname: 'somehost'
52+
hostname: 'somehost',
53+
port: 12345
4754
}).title,
48-
'somehost'
55+
'somehost:12345'
4956
);
5057
});
5158
});

0 commit comments

Comments
 (0)