@@ -8,6 +8,7 @@ import fs from 'fs-extra';
88import path from 'path' ;
99import rimraf from 'rimraf' ;
1010import Logger from 'browser/services/logger' ;
11+ import Platform from 'browser/services/platform' ;
1112import Downloader from 'browser/model/helpers/downloader' ;
1213import Util from 'browser/model/helpers/util' ;
1314import JdkInstall from 'browser/model/jdk-install' ;
@@ -133,26 +134,6 @@ describe('JDK installer', function() {
133134 } ) ;
134135 } ) ;
135136
136- it ( 'should select openjdk for installation if not java detected' , function ( done ) {
137- let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
138- mockDetectedJvm ( '' ) ;
139- return jdk . detectExistingInstall ( function ( ) {
140- expect ( jdk . selectedOption ) . to . be . equal ( 'install' ) ;
141- expect ( jdk . getLocation ( ) ) . to . be . equal ( '' ) ;
142- done ( ) ;
143- } ) ;
144- } ) ;
145-
146- it ( 'should select openjdk for installation if newer than supported version detected' , function ( done ) {
147- let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
148- mockDetectedJvm ( '1.9.0_1' ) ;
149- return jdk . detectExistingInstall ( function ( ) {
150- expect ( jdk . selectedOption ) . to . be . equal ( 'install' ) ;
151- expect ( jdk . getLocation ( ) ) . to . be . equal ( '' ) ;
152- done ( ) ;
153- } ) ;
154- } ) ;
155-
156137 it ( 'should create deafult empty callback if not provided' , function ( ) {
157138 let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
158139 mockDetectedJvm ( '1.8.0_1' ) ;
@@ -163,8 +144,31 @@ describe('JDK installer', function() {
163144 }
164145 } ) ;
165146
166- if ( process . platform !== 'darwin' ) {
167- it ( 'should check for available msi installtion on windows platform' , function ( done ) {
147+ describe ( 'on windows' , function ( ) {
148+ it ( 'should select openjdk for installation if not java detected' , function ( done ) {
149+ sandbox . stub ( Platform , 'getOS' ) . returns ( 'win32' ) ;
150+ let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
151+ mockDetectedJvm ( '' ) ;
152+ return jdk . detectExistingInstall ( function ( ) {
153+ expect ( jdk . selectedOption ) . to . be . equal ( 'install' ) ;
154+ expect ( jdk . getLocation ( ) ) . to . be . equal ( '' ) ;
155+ done ( ) ;
156+ } ) ;
157+ } ) ;
158+
159+ it ( 'should select openjdk for installation if newer than supported version detected' , function ( done ) {
160+ sandbox . stub ( Platform , 'getOS' ) . returns ( 'win32' ) ;
161+ let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
162+ mockDetectedJvm ( '1.9.0_1' ) ;
163+ return jdk . detectExistingInstall ( function ( ) {
164+ expect ( jdk . selectedOption ) . to . be . equal ( 'install' ) ;
165+ expect ( jdk . getLocation ( ) ) . to . be . equal ( '' ) ;
166+ done ( ) ;
167+ } ) ;
168+ } ) ;
169+
170+ it ( 'should check for available msi installtion' , function ( done ) {
171+ sandbox . stub ( Platform , 'getOS' ) . returns ( 'win32' ) ;
168172 mockDetectedJvm ( '1.8.0_1' ) ;
169173 let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
170174 jdk . findMsiInstalledJava . restore ( ) ;
@@ -174,8 +178,31 @@ describe('JDK installer', function() {
174178 done ( ) ;
175179 } ) ;
176180 } ) ;
177- } else {
178- it ( 'should not check for available msi installtion on none windows platforms' , function ( done ) {
181+ } ) ;
182+
183+ describe ( 'on macos' , function ( ) {
184+ it ( 'should not select jdk for installation if not java detected' , function ( done ) {
185+ sandbox . stub ( Platform , 'getOS' ) . returns ( 'darwin' ) ;
186+ let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
187+ mockDetectedJvm ( '' ) ;
188+ return jdk . detectExistingInstall ( function ( ) {
189+ expect ( jdk . selectedOption ) . to . be . equal ( 'detected' ) ;
190+ done ( ) ;
191+ } ) ;
192+ } ) ;
193+
194+ it ( 'should not select openjdk for installation if newer than supported version detected' , function ( done ) {
195+ sandbox . stub ( Platform , 'getOS' ) . returns ( 'darwin' ) ;
196+ let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
197+ mockDetectedJvm ( '1.9.0_1' ) ;
198+ return jdk . detectExistingInstall ( function ( ) {
199+ expect ( jdk . selectedOption ) . to . be . equal ( 'detected' ) ;
200+ done ( ) ;
201+ } ) ;
202+ } ) ;
203+
204+ it ( 'should not check for available msi installtion' , function ( done ) {
205+ sandbox . stub ( Platform , 'getOS' ) . returns ( 'darwin' ) ;
179206 mockDetectedJvm ( '1.8.0_1' ) ;
180207 let jdk = new JdkInstall ( installerDataSvc , 'url' , 'file' ) ;
181208 jdk . findMsiInstalledJava . restore ( ) ;
@@ -185,7 +212,7 @@ describe('JDK installer', function() {
185212 done ( ) ;
186213 } ) ;
187214 } ) ;
188- }
215+ } ) ;
189216 } ) ;
190217
191218 describe ( 'when downloading the jdk msi' , function ( ) {
0 commit comments