Skip to content

Commit a59ce2d

Browse files
authored
Fix connected property value (#453)
## What does this PR do? The `kuzzle.connected` property which delegate to the protocol was testing a wrong `protocol.state` value (`'online'` instead of `'connected'`).
1 parent 3e9ef76 commit a59ce2d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/protocols/abstract/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AbstractWrapper extends KuzzleEventEmitter {
4040
}
4141

4242
get connected () {
43-
return this.state === 'online';
43+
return this.state === 'connected';
4444
}
4545

4646
get pendingRequests () {

test/protocol/common.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ describe('Common Protocol', () => {
1818
sendSpy = sinon.spy(protocol, 'send');
1919
});
2020

21+
describe('#connected', () => {
22+
it('should return true if the protocol state is "connected"', () => {
23+
protocol.state = 'connected';
24+
25+
should(protocol.connected).be.True();
26+
27+
protocol.state = 'disconnected';
28+
29+
should(protocol.connected).be.False();
30+
});
31+
});
32+
2133
describe('#query', () => {
2234

2335
beforeEach(() => {

0 commit comments

Comments
 (0)