@@ -272,11 +272,12 @@ describe( 'commands/status', () => {
272272 compact : true
273273 }
274274 } ) ;
275+
275276 expect ( stubs . table . push . firstCall . args [ 0 ] ) . to . deep . equal (
276- [ 'foo ' , 'master ↓2 ' , 'abcd123 ' , 'M1 ' ]
277+ [ 'bar ' , 't/1 ↑3 ' , 'ef45678 ' , '+1 ?1 ' ]
277278 ) ;
278279 expect ( stubs . table . push . secondCall . args [ 0 ] ) . to . deep . equal (
279- [ 'bar ' , 't/1 ↑3 ' , 'ef45678 ' , '+1 ?1 ' ]
280+ [ 'foo ' , 'master ↓2 ' , 'abcd123 ' , 'M1 ' ]
280281 ) ;
281282
282283 expect ( stubs . table . toString . calledOnce ) . to . equal ( true ) ;
@@ -378,5 +379,47 @@ describe( 'commands/status', () => {
378379
379380 logStub . restore ( ) ;
380381 } ) ;
382+
383+ it ( 'sorts packages by alphabetically' , ( ) => {
384+ const logStub = sandbox . stub ( console , 'log' ) ;
385+
386+ const processedPackages = new Set ( ) ;
387+ const commandResponses = new Set ( ) ;
388+
389+ processedPackages . add ( '@ckeditor/ckeditor5-foo' ) ;
390+ processedPackages . add ( '@ckeditor/ckeditor5-bar' ) ;
391+ processedPackages . add ( '@ckeditor/ckeditor5-bom' ) ;
392+ processedPackages . add ( '@ckeditor/ckeditor5-aaa' ) ;
393+
394+ commandResponses . add ( getCommandResponse ( 'foo' , '1111111' ) ) ;
395+ commandResponses . add ( getCommandResponse ( 'bar' , '2222222' ) ) ;
396+ commandResponses . add ( getCommandResponse ( 'bom' , '3333333' ) ) ;
397+ commandResponses . add ( getCommandResponse ( 'aaa' , '4444444' ) ) ;
398+
399+ statusCommand . afterExecute ( processedPackages , commandResponses ) ;
400+
401+ expect ( stubs . table . push . getCall ( 0 ) . args [ 0 ] [ 0 ] , 1 ) . to . equal ( 'aaa' ) ;
402+ expect ( stubs . table . push . getCall ( 1 ) . args [ 0 ] [ 0 ] , 2 ) . to . equal ( 'bar' ) ;
403+ expect ( stubs . table . push . getCall ( 2 ) . args [ 0 ] [ 0 ] , 3 ) . to . equal ( 'bom' ) ;
404+ expect ( stubs . table . push . getCall ( 3 ) . args [ 0 ] [ 0 ] , 4 ) . to . equal ( 'foo' ) ;
405+
406+ logStub . restore ( ) ;
407+
408+ function getCommandResponse ( packageName , commit ) {
409+ return {
410+ packageName,
411+ status : {
412+ branch : 'master' ,
413+ ahead : 0 ,
414+ behind : 0 ,
415+ staged : [ ] ,
416+ modified : [ ] ,
417+ untracked : [ ] ,
418+ } ,
419+ mgitBranch : 'master' ,
420+ commit
421+ } ;
422+ }
423+ } ) ;
381424 } ) ;
382425} ) ;
0 commit comments