Skip to content

Commit 6408739

Browse files
author
Joe Goggins
committed
Bugfix: getEventStream() should honor defaultAuth
1 parent 05d7efc commit 6408739

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Particle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ class Particle {
891891
uri += `/${encodeURIComponent(name)}`;
892892
}
893893

894+
auth = this._getActiveAuthToken(auth);
894895
return new EventStream(`${this.baseUrl}${uri}`, auth).connect();
895896
}
896897

test/Particle.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,13 @@ describe('ParticleAPI', () => {
10311031
uri.should.endWith(`v1/products/test-product/devices/${props.deviceId}/events/foo`);
10321032
});
10331033
});
1034+
1035+
it('calls _getActiveAuthToken(auth)', () => {
1036+
const fakeToken = 'abc123';
1037+
sinon.stub(api, '_getActiveAuthToken').returns(fakeToken);
1038+
api.getEventStream({});
1039+
expect(api._getActiveAuthToken).to.have.property('callCount', 1);
1040+
});
10341041
});
10351042

10361043
describe('.publishEvent', () => {

0 commit comments

Comments
 (0)