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 1
1
import { sinon , expect } from './test-setup' ;
2
2
import http from 'http' ;
3
3
import { EventEmitter } from 'events' ;
4
-
5
4
import EventStream from '../src/EventStream' ;
6
5
7
6
describe ( 'EventStream' , ( ) => {
@@ -42,7 +41,10 @@ describe('EventStream', () => {
42
41
return fakeRequest ;
43
42
} ) ;
44
43
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 } ) ;
46
48
47
49
return eventStream . connect ( ) . then ( ( ) => {
48
50
expect ( http . request ) . to . have . been . calledWith ( {
@@ -51,7 +53,8 @@ describe('EventStream', () => {
51
53
path : '/path?access_token=token' ,
52
54
method : 'get' ,
53
55
port : 8080 ,
54
- mode : 'prefer-streaming'
56
+ mode : 'prefer-streaming' ,
57
+ headers
55
58
} ) ;
56
59
} ) ;
57
60
} ) ;
Original file line number Diff line number Diff line change @@ -929,7 +929,7 @@ describe('ParticleAPI', () => {
929
929
describe ( '.getEventStream' , ( ) => {
930
930
before ( ( ) => {
931
931
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 } ) ;
933
933
} ) ;
934
934
} ) ;
935
935
You can’t perform that action at this time.
0 commit comments