Skip to content

Commit

Permalink
Added Console Interface Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
vinicioslc committed Dec 12, 2019
1 parent 67d7617 commit da573a9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/adb-actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ export class ADBInterface {
)
return `${ipAddress} | ${nameOfDevice}`
})
console.log('ips', ips)
// found devices on lan
let moreips = await NetHelpers.getAllLanIPs()
console.log('moreips', moreips)
for (const variable of moreips) {
ips.push(variable)
}
Expand Down
14 changes: 14 additions & 0 deletions src/console-interface/console-interface-mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { execSync } from 'child_process'
import { IConsoleInterface } from './iconsole-interface'

export class ConsoleInterface implements IConsoleInterface {
_output: Buffer

setConsoleOutput(output: string): void {
this._output = Buffer.from(output, 'utf8')
}

sendConsoleSync(command: string): Buffer {
return this._output
}
}
8 changes: 8 additions & 0 deletions src/console-interface/console-interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { execSync } from 'child_process'
import { IConsoleInterface } from './iconsole-interface'

export class ConsoleInterface implements IConsoleInterface {
sendConsoleSync(command: string): Buffer {
return execSync(command)
}
}
3 changes: 3 additions & 0 deletions src/console-interface/iconsole-interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IConsoleInterface {
sendConsoleSync(command: string): Buffer
}

0 comments on commit da573a9

Please sign in to comment.