@@ -18,6 +18,7 @@ suite('REPL - Native REPL', () => {
1818 let setReplDirectoryStub : sinon . SinonStub ;
1919 let setReplControllerSpy : sinon . SinonSpy ;
2020 let getWorkspaceStateValueStub : sinon . SinonStub ;
21+ let updateWorkspaceStateValueStub : sinon . SinonStub ;
2122
2223 setup ( ( ) => {
2324 interpreterService = TypeMoq . Mock . ofType < IInterpreterService > ( ) ;
@@ -30,7 +31,7 @@ suite('REPL - Native REPL', () => {
3031 setReplDirectoryStub = sinon . stub ( NativeRepl . prototype as any , 'setReplDirectory' ) . resolves ( ) ; // Stubbing private method
3132 // Use a spy instead of a stub for setReplController
3233 setReplControllerSpy = sinon . spy ( NativeRepl . prototype , 'setReplController' ) ;
33- getWorkspaceStateValueStub = sinon . stub ( persistentState , 'getWorkspaceStateValue ' ) . returns ( undefined ) ;
34+ updateWorkspaceStateValueStub = sinon . stub ( persistentState , 'updateWorkspaceStateValue ' ) . resolves ( ) ;
3435 } ) ;
3536
3637 teardown ( ( ) => {
@@ -55,6 +56,7 @@ suite('REPL - Native REPL', () => {
5556 } ) ;
5657
5758 test ( 'sendToNativeRepl should look for memento URI if notebook document is undefined' , async ( ) => {
59+ getWorkspaceStateValueStub = sinon . stub ( persistentState , 'getWorkspaceStateValue' ) . returns ( undefined ) ;
5860 interpreterService
5961 . setup ( ( i ) => i . getActiveInterpreter ( TypeMoq . It . isAny ( ) ) )
6062 . returns ( ( ) => Promise . resolve ( ( { path : 'ps' } as unknown ) as PythonEnvironment ) ) ;
@@ -66,6 +68,19 @@ suite('REPL - Native REPL', () => {
6668 expect ( getWorkspaceStateValueStub . calledOnce ) . to . be . true ;
6769 } ) ;
6870
71+ test ( 'sendToNativeRepl should call updateWorkspaceStateValue' , async ( ) => {
72+ getWorkspaceStateValueStub = sinon . stub ( persistentState , 'getWorkspaceStateValue' ) . returns ( 'myNameIsMemento' ) ;
73+ interpreterService
74+ . setup ( ( i ) => i . getActiveInterpreter ( TypeMoq . It . isAny ( ) ) )
75+ . returns ( ( ) => Promise . resolve ( ( { path : 'ps' } as unknown ) as PythonEnvironment ) ) ;
76+ const interpreter = await interpreterService . object . getActiveInterpreter ( ) ;
77+ const nativeRepl = await getNativeRepl ( interpreter as PythonEnvironment , disposableArray ) ;
78+
79+ nativeRepl . sendToNativeRepl ( undefined , false ) ;
80+
81+ expect ( updateWorkspaceStateValueStub . calledOnce ) . to . be . true ;
82+ } ) ;
83+
6984 test ( 'create should call setReplDirectory, setReplController' , async ( ) => {
7085 const interpreter = await interpreterService . object . getActiveInterpreter ( ) ;
7186 interpreterService
0 commit comments