@@ -69,13 +69,12 @@ function getFullSyncResult(): ILiveSyncResultInfo {
6969}
7070
7171function mockDevicesService ( injector : IInjector , devices : Mobile . IDevice [ ] ) {
72- const devicesService : Mobile . IDevicesService = injector . resolve (
73- "devicesService"
74- ) ;
72+ const devicesService : Mobile . IDevicesService =
73+ injector . resolve ( "devicesService" ) ;
7574 devicesService . execute = async (
7675 action : ( device : Mobile . IDevice ) => Promise < any > ,
7776 canExecute ?: ( dev : Mobile . IDevice ) => boolean ,
78- options ?: { allowNoDevices ?: boolean }
77+ options ?: { allowNoDevices ?: boolean } ,
7978 ) => {
8079 for ( const d of devices ) {
8180 if ( canExecute ( < any > d ) ) {
@@ -132,12 +131,15 @@ function createTestInjector() {
132131 injector . register ( "debugController" , { } ) ;
133132 injector . register ( "liveSyncProcessDataService" , LiveSyncProcessDataService ) ;
134133 injector . register ( "tempService" , TempServiceStub ) ;
134+ injector . register ( "staticConfig" , {
135+ getAdbFilePath : async ( ) => "adb" ,
136+ } ) ;
135137
136138 const devicesService = injector . resolve ( "devicesService" ) ;
137139 devicesService . getDevicesForPlatform = ( ) =>
138140 < any > [ { identifier : "myTestDeviceId1" } ] ;
139141 devicesService . getPlatformsFromDeviceDescriptors = (
140- devices : ILiveSyncDeviceDescriptor [ ]
142+ devices : ILiveSyncDeviceDescriptor [ ] ,
141143 ) => devices . map ( ( d ) => map [ d . identifier ] . device . deviceInfo . platform ) ;
142144 devicesService . on = ( ) => ( { } ) ;
143145
@@ -206,20 +208,17 @@ describe("RunController", () => {
206208 describe ( "watch" , ( ) => {
207209 const testCases = [
208210 {
209- name :
210- "should prepare only ios platform when only ios devices are connected" ,
211+ name : "should prepare only ios platform when only ios devices are connected" ,
211212 connectedDevices : [ iOSDeviceDescriptor ] ,
212213 expectedPreparedPlatforms : [ "ios" ] ,
213214 } ,
214215 {
215- name :
216- "should prepare only android platform when only android devices are connected" ,
216+ name : "should prepare only android platform when only android devices are connected" ,
217217 connectedDevices : [ androidDeviceDescriptor ] ,
218218 expectedPreparedPlatforms : [ "android" ] ,
219219 } ,
220220 {
221- name :
222- "should prepare both platforms when ios and android devices are connected" ,
221+ name : "should prepare both platforms when ios and android devices are connected" ,
223222 connectedDevices : [ iOSDeviceDescriptor , androidDeviceDescriptor ] ,
224223 expectedPreparedPlatforms : [ "ios" , "android" ] ,
225224 } ,
@@ -229,15 +228,14 @@ describe("RunController", () => {
229228 it ( testCase . name , async ( ) => {
230229 mockDevicesService (
231230 injector ,
232- testCase . connectedDevices . map ( ( d ) => map [ d . identifier ] . device )
231+ testCase . connectedDevices . map ( ( d ) => map [ d . identifier ] . device ) ,
233232 ) ;
234233
235234 const preparedPlatforms : string [ ] = [ ] ;
236- const prepareController : PrepareController = injector . resolve (
237- "prepareController"
238- ) ;
235+ const prepareController : PrepareController =
236+ injector . resolve ( "prepareController" ) ;
239237 prepareController . prepare = async (
240- currentPrepareData : PrepareData
238+ currentPrepareData : PrepareData ,
241239 ) => {
242240 preparedPlatforms . push ( currentPrepareData . platform ) ;
243241 return {
@@ -253,7 +251,7 @@ describe("RunController", () => {
253251
254252 assert . deepStrictEqual (
255253 preparedPlatforms ,
256- testCase . expectedPreparedPlatforms
254+ testCase . expectedPreparedPlatforms ,
257255 ) ;
258256 } ) ;
259257 } ) ;
@@ -263,41 +261,35 @@ describe("RunController", () => {
263261 describe ( "stopRunOnDevices" , ( ) => {
264262 const testCases = [
265263 {
266- name :
267- "stops LiveSync operation for all devices and emits liveSyncStopped for all of them when stopLiveSync is called without deviceIdentifiers" ,
264+ name : "stops LiveSync operation for all devices and emits liveSyncStopped for all of them when stopLiveSync is called without deviceIdentifiers" ,
268265 currentDeviceIdentifiers : [ "device1" , "device2" , "device3" ] ,
269266 expectedDeviceIdentifiers : [ "device1" , "device2" , "device3" ] ,
270267 } ,
271268 {
272- name :
273- "stops LiveSync operation for all devices and emits liveSyncStopped for all of them when stopLiveSync is called without deviceIdentifiers (when a single device is attached)" ,
269+ name : "stops LiveSync operation for all devices and emits liveSyncStopped for all of them when stopLiveSync is called without deviceIdentifiers (when a single device is attached)" ,
274270 currentDeviceIdentifiers : [ "device1" ] ,
275271 expectedDeviceIdentifiers : [ "device1" ] ,
276272 } ,
277273 {
278- name :
279- "stops LiveSync operation for specified devices and emits liveSyncStopped for each of them (when a single device is attached)" ,
274+ name : "stops LiveSync operation for specified devices and emits liveSyncStopped for each of them (when a single device is attached)" ,
280275 currentDeviceIdentifiers : [ "device1" ] ,
281276 expectedDeviceIdentifiers : [ "device1" ] ,
282277 deviceIdentifiersToBeStopped : [ "device1" ] ,
283278 } ,
284279 {
285- name :
286- "stops LiveSync operation for specified devices and emits liveSyncStopped for each of them" ,
280+ name : "stops LiveSync operation for specified devices and emits liveSyncStopped for each of them" ,
287281 currentDeviceIdentifiers : [ "device1" , "device2" , "device3" ] ,
288282 expectedDeviceIdentifiers : [ "device1" , "device3" ] ,
289283 deviceIdentifiersToBeStopped : [ "device1" , "device3" ] ,
290284 } ,
291285 {
292- name :
293- "does not raise liveSyncStopped event for device, which is not currently being liveSynced" ,
286+ name : "does not raise liveSyncStopped event for device, which is not currently being liveSynced" ,
294287 currentDeviceIdentifiers : [ "device1" , "device2" , "device3" ] ,
295288 expectedDeviceIdentifiers : [ "device1" ] ,
296289 deviceIdentifiersToBeStopped : [ "device1" , "device4" ] ,
297290 } ,
298291 {
299- name :
300- "stops LiveSync operation for all devices when stop method is called with empty array" ,
292+ name : "stops LiveSync operation for all devices when stop method is called with empty array" ,
301293 currentDeviceIdentifiers : [ "device1" , "device2" , "device3" ] ,
302294 expectedDeviceIdentifiers : [ "device1" , "device2" , "device3" ] ,
303295 deviceIdentifiersToBeStopped : [ ] ,
@@ -307,22 +299,22 @@ describe("RunController", () => {
307299 for ( const testCase of testCases ) {
308300 it ( testCase . name , async ( ) => {
309301 const liveSyncProcessDataService = injector . resolve (
310- "liveSyncProcessDataService"
302+ "liveSyncProcessDataService" ,
311303 ) ;
312304 ( < any > liveSyncProcessDataService ) . persistData (
313305 projectDir ,
314306 testCase . currentDeviceIdentifiers . map (
315- ( identifier ) => < any > { identifier }
307+ ( identifier ) => < any > { identifier } ,
316308 ) ,
317- [ "ios" ]
309+ [ "ios" ] ,
318310 ) ;
319311
320312 const emittedDeviceIdentifiersForLiveSyncStoppedEvent : string [ ] = [ ] ;
321313
322314 runController . on ( RunOnDeviceEvents . runOnDeviceStopped , ( data : any ) => {
323315 assert . equal ( data . projectDir , projectDir ) ;
324316 emittedDeviceIdentifiersForLiveSyncStoppedEvent . push (
325- data . deviceIdentifier
317+ data . deviceIdentifier ,
326318 ) ;
327319 } ) ;
328320
@@ -333,7 +325,7 @@ describe("RunController", () => {
333325
334326 assert . deepStrictEqual (
335327 emittedDeviceIdentifiersForLiveSyncStoppedEvent ,
336- testCase . expectedDeviceIdentifiers
328+ testCase . expectedDeviceIdentifiers ,
337329 ) ;
338330 } ) ;
339331 }
0 commit comments