@@ -104,6 +104,13 @@ define(
104
104
start : 0 ,
105
105
end : 1
106
106
} ;
107
+ } ,
108
+ timeSystem : function ( ) {
109
+ return {
110
+ metadata : {
111
+ key : 'mockTimeSystem'
112
+ }
113
+ } ;
107
114
}
108
115
}
109
116
} ;
@@ -141,7 +148,8 @@ define(
141
148
id : "testId" , // from domain object
142
149
source : "testSource" , // from model
143
150
key : "testKey" , // from model
144
- start : 42 // from argument
151
+ start : 42 , // from argument
152
+ domain : 'mockTimeSystem'
145
153
} ] ) ;
146
154
} ) ;
147
155
@@ -160,7 +168,8 @@ define(
160
168
source : "testSource" ,
161
169
key : "testKey" ,
162
170
start : 0 ,
163
- end : 1
171
+ end : 1 ,
172
+ domain : 'mockTimeSystem'
164
173
} ) ;
165
174
} ) ;
166
175
@@ -176,7 +185,8 @@ define(
176
185
source : "testSource" , // from model
177
186
key : "testId" , // from domain object
178
187
start : 0 ,
179
- end : 1
188
+ end : 1 ,
189
+ domain : 'mockTimeSystem'
180
190
} ) ;
181
191
} ) ;
182
192
@@ -257,7 +267,8 @@ define(
257
267
source : "testSource" ,
258
268
key : "testKey" ,
259
269
start : 0 ,
260
- end : 1
270
+ end : 1 ,
271
+ domain : 'mockTimeSystem'
261
272
} ]
262
273
) ;
263
274
@@ -274,8 +285,28 @@ define(
274
285
expect ( mockUnsubscribe ) . not . toHaveBeenCalled ( ) ;
275
286
subscription ( ) ; // should be an unsubscribe function
276
287
expect ( mockUnsubscribe ) . toHaveBeenCalled ( ) ;
288
+ } ) ;
289
+
290
+ it ( "applies time conductor bounds if request bounds not defined" , function ( ) {
291
+ var fullRequest = telemetry . buildRequest ( { } ) ;
292
+ var mockBounds = mockAPI . conductor . bounds ( ) ;
293
+
294
+ expect ( fullRequest . start ) . toBe ( mockBounds . start ) ;
295
+ expect ( fullRequest . end ) . toBe ( mockBounds . end ) ;
296
+
297
+ fullRequest = telemetry . buildRequest ( { start : 10 , end : 20 } ) ;
298
+
299
+ expect ( fullRequest . start ) . toBe ( 10 ) ;
300
+ expect ( fullRequest . end ) . toBe ( 20 ) ;
301
+ } ) ;
277
302
303
+ it ( "applies domain from time system if none defined" , function ( ) {
304
+ var fullRequest = telemetry . buildRequest ( { } ) ;
305
+ var mockTimeSystem = mockAPI . conductor . timeSystem ( ) ;
306
+ expect ( fullRequest . domain ) . toBe ( mockTimeSystem . metadata . key ) ;
278
307
308
+ fullRequest = telemetry . buildRequest ( { domain : 'someOtherDomain' } ) ;
309
+ expect ( fullRequest . domain ) . toBe ( 'someOtherDomain' ) ;
279
310
} ) ;
280
311
} ) ;
281
312
}
0 commit comments