@@ -24,21 +24,19 @@ describe('xhyve Installer', function() {
2424
2525 describe ( 'detectExistingInstall' , function ( ) {
2626 describe ( 'on macOS' , function ( ) {
27- beforeEach ( function ( ) {
28- sandbox . stub ( Platform , 'isXhyveAvailable' ) . resolves ( true ) ;
29- } ) ;
3027
31- it ( 'first checks if xhyve is available on the current OS version ' , function ( ) {
28+ it ( 'adds option \'detected\' if xhyve detected ' , function ( ) {
3229 sandbox . stub ( child_process , 'exec' ) . yields ( undefined , '/usr/local/bin/docker-machine-driver-xhyve' ) ;
3330 return xhInstall . detectExistingInstall ( ) . then ( function ( ) {
34- expect ( Platform . isXhyveAvailable ) . calledOnce ;
31+ expect ( xhInstall . hasOption ( 'detected' ) ) . to . be . equal ( true ) ;
3532 } ) ;
3633 } ) ;
3734
38- it ( 'adds option \'detected\' if xhyve detection' , function ( ) {
39- sandbox . stub ( child_process , 'exec' ) . yields ( undefined , '/usr/local/bin/docker-machine-driver-xhyve' ) ;
35+ it ( 'removes option \'detected\' if xhyve was uninstalled and detection ran again' , function ( ) {
36+ sandbox . stub ( child_process , 'exec' ) . yields ( undefined , '' ) ;
37+ xhInstall . addOption ( 'detected' ) ;
4038 return xhInstall . detectExistingInstall ( ) . then ( function ( ) {
41- expect ( xhInstall . hasOption ( 'detected' ) ) . to . be . equal ( true ) ;
39+ expect ( xhInstall . hasOption ( 'detected' ) ) . to . be . equal ( false ) ;
4240 } ) ;
4341 } ) ;
4442 } ) ;
@@ -158,4 +156,16 @@ describe('xhyve Installer', function() {
158156 expect ( xhInstall . isDisabled ( ) ) . to . be . equal ( true ) ;
159157 } ) ;
160158 } ) ;
159+
160+ describe ( 'fromJson' , function ( ) {
161+ it ( 'returns new XhyveInstaller instance' , function ( ) {
162+ let data = {
163+ installerDataSvc : new InstallerDataService ( ) ,
164+ downloadUrl : 'url'
165+ } ;
166+ let installer = XhyveInstall . convertor . fromJson ( data ) ;
167+ expect ( installer . installerDataSvc === data . installerDataSvc ) . equals ( true ) ;
168+ expect ( installer . downloadUrl ) . equals ( 'url' ) ;
169+ } ) ;
170+ } ) ;
161171} ) ;
0 commit comments