@@ -133,7 +133,30 @@ describe('start command', function() {
133133 done ( ) ;
134134 } ) ;
135135 } ) ;
136- it ( 'should provide extra content if starting a v2 project' , function ( done ) {
136+
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 ) {
137160 var processArguments = [ 'node' , 'ionic' , 'start' , 'newDir' , '--v2' ] ;
138161 var rawCliArguments = processArguments . slice ( 2 ) ;
139162 var argv = optimist ( rawCliArguments ) . argv ;
@@ -146,6 +169,8 @@ describe('start command', function() {
146169 spyOn ( Start , 'promptLogin' ) . andReturn ( Q ( true ) ) ;
147170
148171 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 ) ;
149174 expect ( log . info ) . toHaveBeenCalledWith (
150175 '\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
151176 ) ;
0 commit comments