1- // Copyright (c) Microsoft Corporation.
2- // Licensed under the MIT License.
3-
41import { assert } from 'chai' ;
52import { anything , instance , mock , verify , when } from 'ts-mockito' ;
63import { CancellationToken , NotebookCell , NotebookCellExecution } from 'vscode' ;
4+
75import { IKernelController } from '../types' ;
86import { CellExecutionCreator , NotebookCellExecutionWrapper } from './cellExecutionCreator' ;
97
@@ -56,11 +54,7 @@ suite('NotebookCellExecutionWrapper', () => {
5654 wrapper . start ( ) ;
5755
5856 // Verify start was called before clearOutput
59- assert . deepStrictEqual (
60- callOrder ,
61- [ 'start' , 'clearOutput' ] ,
62- 'start should be called before clearOutput'
63- ) ;
57+ assert . deepStrictEqual ( callOrder , [ 'start' , 'clearOutput' ] , 'start should be called before clearOutput' ) ;
6458 } ) ;
6559
6660 test ( 'When clearOutputOnStartWithTime is false, clearOutput is not called on start' , ( ) => {
@@ -151,12 +145,7 @@ suite('NotebookCellExecutionWrapper', () => {
151145 } ) ;
152146
153147 test ( 'started flag is false initially and true after start' , ( ) => {
154- const wrapper = new NotebookCellExecutionWrapper (
155- instance ( mockImpl ) ,
156- 'test-controller' ,
157- endCallback ,
158- false
159- ) ;
148+ const wrapper = new NotebookCellExecutionWrapper ( instance ( mockImpl ) , 'test-controller' , endCallback , false ) ;
160149
161150 assert . isFalse ( wrapper . started , 'started should be false before start() is called' ) ;
162151
@@ -197,7 +186,11 @@ suite('NotebookCellExecutionWrapper', () => {
197186 wrapper . clearOutput ( ) ;
198187
199188 // Should have called clearOutput twice now (once from start, once from manual call)
200- assert . strictEqual ( clearOutputCallCount , 2 , 'clearOutput should be called again when manually invoked on reused wrapper' ) ;
189+ assert . strictEqual (
190+ clearOutputCallCount ,
191+ 2 ,
192+ 'clearOutput should be called again when manually invoked on reused wrapper'
193+ ) ;
201194 } ) ;
202195} ) ;
203196
@@ -251,9 +244,7 @@ suite('CellExecutionCreator', () => {
251244 // Create mock controller
252245 const mockController = mock < IKernelController > ( ) ;
253246 when ( mockController . id ) . thenReturn ( 'test-controller' ) ;
254- when ( mockController . createNotebookCellExecution ( anything ( ) ) )
255- . thenReturn ( spyImpl1 )
256- . thenReturn ( spyImpl2 ) ;
247+ when ( mockController . createNotebookCellExecution ( anything ( ) ) ) . thenReturn ( spyImpl1 ) . thenReturn ( spyImpl2 ) ;
257248
258249 // First execution: Create a new execution wrapper
259250 const execution1 = CellExecutionCreator . getOrCreate ( instance ( mockCell ) , instance ( mockController ) , true ) ;
@@ -277,11 +268,7 @@ suite('CellExecutionCreator', () => {
277268 assert . isTrue ( execution2 . started , 'New execution should be started automatically' ) ;
278269
279270 // clearOutput should have been called again during the new execution's start
280- assert . strictEqual (
281- clearOutputCallCount ,
282- 2 ,
283- 'clearOutput should be called again when new execution starts'
284- ) ;
271+ assert . strictEqual ( clearOutputCallCount , 2 , 'clearOutput should be called again when new execution starts' ) ;
285272
286273 // Clean up - end the execution to remove it from the map
287274 execution2 . end ( true ) ;
0 commit comments