@@ -47,7 +47,6 @@ describe('start command', function() {
4747 expect ( start . options [ '--io-app-id' ] ) . toEqual ( jasmine . any ( String ) ) ;
4848 expect ( start . options [ '--template|-t' ] ) . toEqual ( jasmine . any ( String ) ) ;
4949 expect ( start . options [ '--v2|-v' ] ) . toEqual ( jasmine . any ( Object ) ) ;
50- expect ( start . options [ '--typescript|--ts' ] ) . toEqual ( jasmine . any ( Object ) ) ;
5150 expect ( start . options [ '--zip-file|-z' ] ) . toEqual ( jasmine . any ( String ) ) ;
5251 } ) ;
5352 } ) ;
@@ -134,74 +133,32 @@ describe('start command', function() {
134133 } ) ;
135134 } ) ;
136135
137- it ( 'should default to typescript if starting a v2 project with -v' , function ( done ) {
138- var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' , '-v' ] ;
139- var rawCliArguments = processArguments . slice ( 2 ) ;
140- var argv = optimist ( rawCliArguments ) . argv ;
141-
142- spyOn ( fs , 'existsSync' ) . andReturn ( false ) ;
143- spyOn ( appLibUtils , 'preprocessCliOptions' ) . andCallThrough ( ) ;
144- spyOn ( Start , 'promptForOverwrite' ) ;
145- spyOn ( Start , 'startApp' ) . andReturn ( Q ( true ) ) ;
146- spyOn ( Start , 'printQuickHelp' ) . andReturn ( Q ( true ) ) ;
147- spyOn ( Start , 'promptLogin' ) . andReturn ( Q ( true ) ) ;
148-
149- start . run ( { } , argv ) . then ( function ( ) {
150- expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . v ) . toEqual ( true ) ;
151- expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . ts ) . toEqual ( true ) ;
152- expect ( log . info ) . toHaveBeenCalledWith (
153- '\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
154- ) ;
155- done ( ) ;
156- } ) ;
157- } ) ;
158-
159- it ( 'should default to typescript if starting a v2 project with --v2' , function ( done ) {
160- var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' , '--v2' ] ;
136+ it ( 'should catch error if any process throws' , function ( done ) {
137+ var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' ] ;
161138 var rawCliArguments = processArguments . slice ( 2 ) ;
162139 var argv = optimist ( rawCliArguments ) . argv ;
163140
164141 spyOn ( fs , 'existsSync' ) . andReturn ( false ) ;
142+ spyOn ( log , 'error' ) ;
165143 spyOn ( appLibUtils , 'preprocessCliOptions' ) . andCallThrough ( ) ;
166144 spyOn ( Start , 'promptForOverwrite' ) ;
167- spyOn ( Start , 'startApp' ) . andReturn ( Q ( true ) ) ;
168- spyOn ( Start , 'printQuickHelp' ) . andReturn ( Q ( true ) ) ;
169- spyOn ( Start , 'promptLogin' ) . andReturn ( Q ( true ) ) ;
145+ spyOn ( Start , 'startApp' ) . andReturn ( Q . reject ( false ) ) ;
146+ spyOn ( Start , 'printQuickHelp' ) ;
147+ spyOn ( Start , 'promptLogin' ) ;
170148
171- start . run ( { } , argv ) . then ( function ( ) {
172- expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . v2 ) . toEqual ( true ) ;
173- expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . ts ) . toEqual ( true ) ;
174- expect ( log . info ) . toHaveBeenCalledWith (
175- '\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
176- ) ;
149+ start . run ( { } , argv ) . catch ( function ( ) {
150+ expect ( appLibUtils . preprocessCliOptions ) . toHaveBeenCalled ( ) ;
151+ expect ( Start . promptForOverwrite ) . not . toHaveBeenCalled ( ) ;
152+ expect ( Start . startApp ) . toHaveBeenCalled ( ) ;
153+ expect ( Start . printQuickHelp ) . not . toHaveBeenCalled ( ) ;
154+ expect ( Start . promptLogin ) . not . toHaveBeenCalled ( ) ;
177155 done ( ) ;
178156 } ) ;
179157 } ) ;
180158
181- it ( 'should use javascript if starting a v2 project with --v2 and --no-ts' , function ( done ) {
182- var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' , '--v2' , '--no-ts' ] ;
183- var rawCliArguments = processArguments . slice ( 2 ) ;
184- var argv = optimist ( rawCliArguments ) . argv ;
185159
186- spyOn ( fs , 'existsSync' ) . andReturn ( false ) ;
187- spyOn ( appLibUtils , 'preprocessCliOptions' ) . andCallThrough ( ) ;
188- spyOn ( Start , 'promptForOverwrite' ) ;
189- spyOn ( Start , 'startApp' ) . andReturn ( Q ( true ) ) ;
190- spyOn ( Start , 'printQuickHelp' ) . andReturn ( Q ( true ) ) ;
191- spyOn ( Start , 'promptLogin' ) . andReturn ( Q ( true ) ) ;
192-
193- start . run ( { } , argv ) . then ( function ( ) {
194- expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . v2 ) . toEqual ( true ) ;
195- expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . ts ) . toEqual ( false ) ;
196- expect ( log . info ) . toHaveBeenCalledWith (
197- '\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
198- ) ;
199- done ( ) ;
200- } ) ;
201- } ) ;
202-
203- it ( 'should use javascript if starting a v2 project with --v2 and --no-typescript' , function ( done ) {
204- var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' , '--v2' , '--no-typescript' ] ;
160+ it ( 'should print a getting started message with v2 projects' , function ( done ) {
161+ var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' , '--v2' ] ;
205162 var rawCliArguments = processArguments . slice ( 2 ) ;
206163 var argv = optimist ( rawCliArguments ) . argv ;
207164
@@ -214,35 +171,11 @@ describe('start command', function() {
214171
215172 start . run ( { } , argv ) . then ( function ( ) {
216173 expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . v2 ) . toEqual ( true ) ;
217- expect ( appLibUtils . preprocessCliOptions . calls [ 0 ] . args [ 0 ] . typescript ) . toEqual ( false ) ;
218174 expect ( log . info ) . toHaveBeenCalledWith (
219175 '\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
220176 ) ;
221177 done ( ) ;
222178 } ) ;
223179 } ) ;
224-
225- it ( 'should catch error if any process throws' , function ( done ) {
226- var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' ] ;
227- var rawCliArguments = processArguments . slice ( 2 ) ;
228- var argv = optimist ( rawCliArguments ) . argv ;
229-
230- spyOn ( fs , 'existsSync' ) . andReturn ( false ) ;
231- spyOn ( log , 'error' ) ;
232- spyOn ( appLibUtils , 'preprocessCliOptions' ) . andCallThrough ( ) ;
233- spyOn ( Start , 'promptForOverwrite' ) ;
234- spyOn ( Start , 'startApp' ) . andReturn ( Q . reject ( false ) ) ;
235- spyOn ( Start , 'printQuickHelp' ) ;
236- spyOn ( Start , 'promptLogin' ) ;
237-
238- start . run ( { } , argv ) . catch ( function ( ) {
239- expect ( appLibUtils . preprocessCliOptions ) . toHaveBeenCalled ( ) ;
240- expect ( Start . promptForOverwrite ) . not . toHaveBeenCalled ( ) ;
241- expect ( Start . startApp ) . toHaveBeenCalled ( ) ;
242- expect ( Start . printQuickHelp ) . not . toHaveBeenCalled ( ) ;
243- expect ( Start . promptLogin ) . not . toHaveBeenCalled ( ) ;
244- done ( ) ;
245- } ) ;
246- } ) ;
247180 } ) ;
248181} ) ;
0 commit comments