@@ -134,6 +134,21 @@ describe('extensionsCommand', () => {
134134 expect . any ( Number ) ,
135135 ) ;
136136 } ) ;
137+
138+ it ( 'should show a message if no extensions are installed' , async ( ) => {
139+ mockGetExtensions . mockReturnValue ( [ ] ) ;
140+ const command = extensionsCommand ( ) ;
141+ if ( ! command . action ) throw new Error ( 'Action not defined' ) ;
142+ await command . action ( mockContext , '' ) ;
143+
144+ expect ( mockContext . ui . addItem ) . toHaveBeenCalledWith (
145+ {
146+ type : MessageType . INFO ,
147+ text : 'No extensions installed. Run `/extensions explore` to check out the gallery.' ,
148+ } ,
149+ expect . any ( Number ) ,
150+ ) ;
151+ } ) ;
137152 } ) ;
138153
139154 describe ( 'completeExtensions' , ( ) => {
@@ -216,6 +231,19 @@ describe('extensionsCommand', () => {
216231 ) ;
217232 } ) ;
218233
234+ it ( 'should show a message if no extensions are installed' , async ( ) => {
235+ mockGetExtensions . mockReturnValue ( [ ] ) ;
236+ await updateAction ( mockContext , 'ext-one' ) ;
237+
238+ expect ( mockContext . ui . addItem ) . toHaveBeenCalledWith (
239+ {
240+ type : MessageType . INFO ,
241+ text : 'No extensions installed. Run `/extensions explore` to check out the gallery.' ,
242+ } ,
243+ expect . any ( Number ) ,
244+ ) ;
245+ } ) ;
246+
219247 it ( 'should inform user if there are no extensions to update with --all' , async ( ) => {
220248 mockDispatchExtensionState . mockImplementationOnce (
221249 ( action : ExtensionUpdateAction ) => {
@@ -607,6 +635,25 @@ describe('extensionsCommand', () => {
607635 mockContext . invocation ! . name = 'restart' ;
608636 } ) ;
609637
638+ it ( 'should show a message if no extensions are installed' , async ( ) => {
639+ mockContext . services . config ! . getExtensionLoader = vi
640+ . fn ( )
641+ . mockImplementation ( ( ) => ( {
642+ getExtensions : ( ) => [ ] ,
643+ restartExtension : mockRestartExtension ,
644+ } ) ) ;
645+
646+ await restartAction ! ( mockContext , '--all' ) ;
647+
648+ expect ( mockContext . ui . addItem ) . toHaveBeenCalledWith (
649+ {
650+ type : MessageType . INFO ,
651+ text : 'No extensions installed. Run `/extensions explore` to check out the gallery.' ,
652+ } ,
653+ expect . any ( Number ) ,
654+ ) ;
655+ } ) ;
656+
610657 it ( 'restarts all active extensions when --all is provided' , async ( ) => {
611658 const mockExtensions = [
612659 { name : 'ext1' , isActive : true } ,
0 commit comments