@@ -395,6 +395,7 @@ suite('Setup Test Suite', () => {
395395 pythonBinPath : undefined ,
396396 remoteList : undefined ,
397397 sectionCollapsed : undefined ,
398+ selfHostedStudioUrl : null ,
398399 shareLiveToStudio : false
399400 } )
400401 } ) . timeout ( WEBVIEW_TEST_TIMEOUT )
@@ -441,6 +442,7 @@ suite('Setup Test Suite', () => {
441442 pythonBinPath : undefined ,
442443 remoteList : undefined ,
443444 sectionCollapsed : undefined ,
445+ selfHostedStudioUrl : null ,
444446 shareLiveToStudio : true
445447 } )
446448 } ) . timeout ( WEBVIEW_TEST_TIMEOUT )
@@ -495,6 +497,7 @@ suite('Setup Test Suite', () => {
495497 pythonBinPath : undefined ,
496498 remoteList : undefined ,
497499 sectionCollapsed : undefined ,
500+ selfHostedStudioUrl : null ,
498501 shareLiveToStudio : true
499502 } )
500503 } ) . timeout ( WEBVIEW_TEST_TIMEOUT )
@@ -549,6 +552,7 @@ suite('Setup Test Suite', () => {
549552 pythonBinPath : undefined ,
550553 remoteList : { [ dvcDemoPath ] : undefined } ,
551554 sectionCollapsed : undefined ,
555+ selfHostedStudioUrl : null ,
552556 shareLiveToStudio : true
553557 } )
554558 } ) . timeout ( WEBVIEW_TEST_TIMEOUT )
@@ -1332,6 +1336,68 @@ suite('Setup Test Suite', () => {
13321336 )
13331337 } )
13341338
1339+ it ( "should handle a message from the webview to update the user's self hosted url" , async ( ) => {
1340+ const { setup, mockExecuteCommand } = buildSetup ( {
1341+ disposer : disposable
1342+ } )
1343+
1344+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1345+ stub ( Setup . prototype as any , 'getCliCompatible' ) . returns ( true )
1346+
1347+ const webview = await setup . showWebview ( )
1348+ await webview . isReady ( )
1349+
1350+ const mockMessageReceived = getMessageReceivedEmitter ( webview )
1351+
1352+ const commandCalled = new Promise ( resolve =>
1353+ mockExecuteCommand . callsFake ( ( ) => {
1354+ resolve ( undefined )
1355+ return Promise . resolve ( undefined )
1356+ } )
1357+ )
1358+
1359+ mockMessageReceived . fire ( {
1360+ type : MessageFromWebviewType . SAVE_STUDIO_URL
1361+ } )
1362+
1363+ await commandCalled
1364+
1365+ expect ( mockExecuteCommand ) . to . be . calledWithExactly (
1366+ RegisteredCommands . UPDATE_STUDIO_URL
1367+ )
1368+ } ) . timeout ( WEBVIEW_TEST_TIMEOUT )
1369+
1370+ it ( "should handle a message from the webview to remove the user's self hosted url" , async ( ) => {
1371+ const { setup, mockExecuteCommand } = buildSetup ( {
1372+ disposer : disposable
1373+ } )
1374+
1375+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1376+ stub ( Setup . prototype as any , 'getCliCompatible' ) . returns ( true )
1377+
1378+ const webview = await setup . showWebview ( )
1379+ await webview . isReady ( )
1380+
1381+ const commandCalled = new Promise ( resolve =>
1382+ mockExecuteCommand . callsFake ( ( ) => {
1383+ resolve ( undefined )
1384+ return Promise . resolve ( undefined )
1385+ } )
1386+ )
1387+
1388+ const mockMessageReceived = getMessageReceivedEmitter ( webview )
1389+
1390+ mockMessageReceived . fire ( {
1391+ type : MessageFromWebviewType . SAVE_STUDIO_URL
1392+ } )
1393+
1394+ await commandCalled
1395+
1396+ expect ( mockExecuteCommand ) . to . be . calledWithExactly (
1397+ RegisteredCommands . UPDATE_STUDIO_URL
1398+ )
1399+ } ) . timeout ( WEBVIEW_TEST_TIMEOUT )
1400+
13351401 it ( 'should check if experiments and dvc are setup' , async ( ) => {
13361402 const { setup } = buildSetup ( {
13371403 disposer : disposable ,
0 commit comments