File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 11import { sinon , expect } from './test-setup' ;
22import http from 'http' ;
33import { EventEmitter } from 'events' ;
4-
54import EventStream from '../src/EventStream' ;
65
76describe ( 'EventStream' , ( ) => {
@@ -42,7 +41,10 @@ describe('EventStream', () => {
4241 return fakeRequest ;
4342 } ) ;
4443
45- const eventStream = new EventStream ( 'http://hostname:8080/path' , 'token' ) ;
44+ const fakeToolName = 'fake' ;
45+ const fakeToolVersion = '1.2.3' ;
46+ const headers = { 'X-Particle-Tool' : `${ fakeToolName } @${ fakeToolVersion } ` } ;
47+ const eventStream = new EventStream ( 'http://hostname:8080/path' , 'token' , { headers } ) ;
4648
4749 return eventStream . connect ( ) . then ( ( ) => {
4850 expect ( http . request ) . to . have . been . calledWith ( {
@@ -51,7 +53,8 @@ describe('EventStream', () => {
5153 path : '/path?access_token=token' ,
5254 method : 'get' ,
5355 port : 8080 ,
54- mode : 'prefer-streaming'
56+ mode : 'prefer-streaming' ,
57+ headers
5558 } ) ;
5659 } ) ;
5760 } ) ;
Original file line number Diff line number Diff line change @@ -929,7 +929,7 @@ describe('ParticleAPI', () => {
929929 describe ( '.getEventStream' , ( ) => {
930930 before ( ( ) => {
931931 sinon . stub ( EventStream . prototype , 'connect' ) . callsFake ( function connect ( ) {
932- return Promise . resolve ( { uri : this . uri } ) ;
932+ return Promise . resolve ( { uri : this . uri , options : this . options } ) ;
933933 } ) ;
934934 } ) ;
935935
You can’t perform that action at this time.
0 commit comments