@@ -130,7 +130,8 @@ describe('EVAL_EDITOR', () => {
130130 name : ExternalLibraryName . NONE ,
131131 symbols : context . externalSymbols
132132 } ,
133- globals
133+ globals,
134+ languageOptions : context . languageOptions
134135 } ;
135136
136137 const newDefaultState = generateDefaultState ( workspaceLocation , {
@@ -397,7 +398,8 @@ describe('EVAL_TESTCASE', () => {
397398 name : ExternalLibraryName . NONE ,
398399 symbols : context . externalSymbols
399400 } ,
400- globals
401+ globals,
402+ languageOptions : context . languageOptions
401403 } ;
402404
403405 const newDefaultState = generateDefaultState ( workspaceLocation , {
@@ -682,30 +684,30 @@ describe('PLAYGROUND_EXTERNAL_SELECT', () => {
682684 externalLibrary : oldExternalLibraryName
683685 } ) ;
684686
685- const symbols = externalLibraries . get ( newExternalLibraryName ) ! ;
686- const library : Library = {
687- chapter ,
688- external : {
689- name : newExternalLibraryName ,
690- symbols
691- } ,
692- globals
693- } ;
694-
695- return expectSaga ( workspaceSaga )
696- . withState ( newDefaultState )
697- . put ( WorkspaceActions . changeExternalLibrary ( newExternalLibraryName , workspaceLocation ) )
698- . put ( WorkspaceActions . beginClearContext ( workspaceLocation , library , true ) )
699- . put ( WorkspaceActions . clearReplOutput ( workspaceLocation ) )
700- . call ( showSuccessMessage , `Switched to ${ newExternalLibraryName } library` , 1000 )
701- . dispatch ( {
702- type : WorkspaceActions . externalLibrarySelect . type ,
703- payload : {
704- externalLibraryName : newExternalLibraryName ,
705- workspaceLocation
706- }
707- } )
708- . silentRun ( ) ;
687+ return (
688+ expectSaga ( workspaceSaga )
689+ . withState ( newDefaultState )
690+ . put ( WorkspaceActions . changeExternalLibrary ( newExternalLibraryName , workspaceLocation ) )
691+ // beginClearContext is asserted here but the library object can contain
692+ // runtime-specific fields (like languageOptions). Match only the action
693+ // shape we care about (type, workspaceLocation and shouldInitLibrary)
694+ . put . like ( {
695+ action : {
696+ type : WorkspaceActions . beginClearContext . type ,
697+ payload : { workspaceLocation , shouldInitLibrary : true }
698+ }
699+ } )
700+ . put ( WorkspaceActions . clearReplOutput ( workspaceLocation ) )
701+ . call ( showSuccessMessage , `Switched to ${ newExternalLibraryName } library` , 1000 )
702+ . dispatch ( {
703+ type : WorkspaceActions . externalLibrarySelect . type ,
704+ payload : {
705+ externalLibraryName : newExternalLibraryName ,
706+ workspaceLocation
707+ }
708+ } )
709+ . silentRun ( )
710+ ) ;
709711 } ) ;
710712
711713 test ( 'does not call the above when oldExternalLibraryName === newExternalLibraryName' , ( ) => {
@@ -770,7 +772,8 @@ describe('BEGIN_CLEAR_CONTEXT', () => {
770772 name : newExternalLibraryName ,
771773 symbols
772774 } ,
773- globals
775+ globals,
776+ languageOptions : undefined
774777 } ;
775778
776779 return expectSaga ( workspaceSaga )
0 commit comments