@@ -133,53 +133,4 @@ describe('NotebookPicker', () => {
133133 expect ( select . options . length ) . toBeGreaterThanOrEqual ( 1 ) ;
134134 expect ( select . options [ 0 ] ?. value ) . toBe ( '-' ) ;
135135 } ) ;
136-
137- it ( 'should handle null model in handleChange' , async ( ) => {
138- const nullModelPanel : MockNotebookPanel = {
139- context : {
140- ready : Promise . resolve ( ) ,
141- model : {
142- getMetadata : jest . fn ( ) . mockReturnValue ( {
143- notebooks : {
144- nb1 : { id : 'nb1' , name : 'nb1' , cells : [ ] }
145- } ,
146- notebook_names : [ 'nb1' ]
147- } )
148- }
149- } ,
150- model : null
151- } ;
152-
153- document . body . innerHTML = '' ;
154- const widget = new NotebookPicker (
155- nullModelPanel as unknown as NotebookPanel
156- ) as WidgetWithMockOnAfterAttach ;
157- widget . onAfterAttach = jest . fn ( ) ;
158- Widget . attach ( widget , document . body ) ;
159- await framePromise ( ) ;
160-
161- const select = document . querySelector ( 'select' ) as HTMLSelectElement ;
162- simulate ( select , 'change' , { target : { value : 'nb1' } } ) ;
163- await framePromise ( ) ;
164- } ) ;
165-
166- it ( 'should handle invalid metadata in handleChange' , async ( ) => {
167- const consoleErrorSpy = jest
168- . spyOn ( console , 'error' )
169- . mockImplementation ( ( ) => { } ) ;
170- const getMetadata = panel . context . model . getMetadata as jest . Mock ;
171- getMetadata . mockReturnValue ( { invalid : 'metadata' } ) ;
172-
173- const select = document . querySelector ( 'select' ) as HTMLSelectElement ;
174- simulate ( select , 'change' , { target : { value : 'nb1' } } ) ;
175- await framePromise ( ) ;
176-
177- expect ( consoleErrorSpy ) . toHaveBeenCalledWith (
178- 'Invalid deepnote metadata:' ,
179- expect . anything ( )
180- ) ;
181- expect ( model . fromJSON ) . not . toHaveBeenCalled ( ) ;
182-
183- consoleErrorSpy . mockRestore ( ) ;
184- } ) ;
185136} ) ;
0 commit comments