@@ -417,6 +417,37 @@ suite('Notebook API tests', () => {
417417 await saveAllFilesAndCloseAll ( resource ) ;
418418 } ) ;
419419
420+ test ( 'edit API (replaceOutput, USE NotebookCellOutput-type)' , async function ( ) {
421+ assertInitalState ( ) ;
422+ const resource = await createRandomFile ( '' , undefined , 'first' , '.vsctestnb' ) ;
423+ await vscode . commands . executeCommand ( 'vscode.openWith' , resource , 'notebookCoreTest' ) ;
424+
425+ await vscode . notebook . activeNotebookEditor ! . edit ( editBuilder => {
426+ editBuilder . replaceCellOutput ( 0 , [
427+ new vscode . NotebookCellOutput ( 'application/foo' , 'bar' ) ,
428+ new vscode . NotebookCellOutput ( 'application/json' , { data : true } , { metadata : true } ) ,
429+ ] ) ;
430+ } ) ;
431+
432+ const document = vscode . notebook . activeNotebookEditor ?. document ! ;
433+ assert . strictEqual ( document . isDirty , true ) ;
434+ assert . strictEqual ( document . cells . length , 1 ) ;
435+ assert . strictEqual ( document . cells [ 0 ] . outputs . length , 2 ) ;
436+
437+ // consuming is OLD api
438+ const [ one , two ] = document . cells [ 0 ] . outputs ;
439+
440+ assert . strictEqual ( one . outputKind , vscode . CellOutputKind . Rich ) ;
441+ assert . strictEqual ( ( < vscode . CellDisplayOutput > one ) . data [ 'application/foo' ] , 'bar' ) ;
442+ assert . strictEqual ( ( < vscode . CellDisplayOutput > one ) . metadata , undefined ) ;
443+
444+ assert . strictEqual ( two . outputKind , vscode . CellOutputKind . Rich ) ;
445+ assert . deepStrictEqual ( ( < vscode . CellDisplayOutput > two ) . data [ 'application/json' ] , { data : true } ) ;
446+ assert . deepStrictEqual ( ( < vscode . CellDisplayOutput > two ) . metadata , { custom : { metadata : true } } ) ;
447+
448+ await saveAllFilesAndCloseAll ( undefined ) ;
449+ } ) ;
450+
420451 test ( 'edit API (replaceOutput)' , async function ( ) {
421452 assertInitalState ( ) ;
422453 const resource = await createRandomFile ( '' , undefined , 'first' , '.vsctestnb' ) ;
0 commit comments