@@ -43,6 +43,7 @@ describe('lib/project-base', () => {
43
43
this . testStudioManager = {
44
44
initializeRoutes : ( ) => { } ,
45
45
status : 'INITIALIZED' ,
46
+ destroy : ( ) => Promise . resolve ( ) ,
46
47
}
47
48
48
49
sinon . stub ( studio , 'getAndInitializeStudioManager' ) . resolves ( this . testStudioManager )
@@ -736,18 +737,20 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
736
737
it ( 'passes onStudioInit callback with AI enabled and a protocol manager' , async function ( ) {
737
738
const mockSetupProtocol = sinon . stub ( )
738
739
const mockBeforeSpec = sinon . stub ( )
739
- const mockAccessStudioLLM = sinon . stub ( ) . resolves ( true )
740
- const mockSetProtocolDb = sinon . stub ( )
740
+ const mockAccessStudioAI = sinon . stub ( ) . resolves ( true )
741
+ const mockSetProtocolDbPath = sinon . stub ( )
742
+ const mockInitializeStudioAI = sinon . stub ( ) . resolves ( )
741
743
742
744
this . project . spec = { }
743
745
this . project . ctx . coreData . studio = {
744
- canAccessStudioAI : mockAccessStudioLLM ,
746
+ canAccessStudioAI : mockAccessStudioAI ,
745
747
protocolManager : {
746
748
setupProtocol : mockSetupProtocol ,
747
749
beforeSpec : mockBeforeSpec ,
748
- db : { test : 'db' } ,
750
+ dbPath : 'test-db-path' ,
749
751
} ,
750
- setProtocolDb : mockSetProtocolDb ,
752
+ setProtocolDbPath : mockSetProtocolDbPath ,
753
+ initializeStudioAI : mockInitializeStudioAI ,
751
754
}
752
755
753
756
sinon . stub ( browsers , 'connectProtocolToBrowser' ) . resolves ( )
@@ -783,7 +786,7 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
783
786
784
787
expect ( mockSetupProtocol ) . to . be . calledOnce
785
788
expect ( mockBeforeSpec ) . to . be . calledOnce
786
- expect ( mockAccessStudioLLM ) . to . be . calledWith ( {
789
+ expect ( mockAccessStudioAI ) . to . be . calledWith ( {
787
790
family : 'chromium' ,
788
791
name : 'chrome' ,
789
792
channel : 'stable' ,
@@ -796,17 +799,18 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
796
799
} )
797
800
798
801
expect ( this . project [ '_protocolManager' ] ) . to . eq ( this . project . ctx . coreData . studio . protocolManager )
799
- expect ( mockSetProtocolDb ) . to . be . calledWith ( { test : 'db' } )
802
+ expect ( mockSetProtocolDbPath ) . to . be . calledWith ( 'test-db-path' )
803
+ expect ( mockInitializeStudioAI ) . to . be . called
800
804
} )
801
805
802
806
it ( 'passes onStudioInit callback with AI enabled but no protocol manager' , async function ( ) {
803
807
const mockSetupProtocol = sinon . stub ( )
804
808
const mockBeforeSpec = sinon . stub ( )
805
- const mockAccessStudioLLM = sinon . stub ( ) . resolves ( true )
809
+ const mockAccessStudioAI = sinon . stub ( ) . resolves ( true )
806
810
807
811
this . project . spec = { }
808
812
this . project . ctx . coreData . studio = {
809
- canAccessStudioAI : mockAccessStudioLLM ,
813
+ canAccessStudioAI : mockAccessStudioAI ,
810
814
}
811
815
812
816
this . project . browser = {
@@ -836,20 +840,20 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
836
840
837
841
expect ( mockSetupProtocol ) . not . to . be . called
838
842
expect ( mockBeforeSpec ) . not . to . be . called
839
- expect ( mockAccessStudioLLM ) . not . to . be . called
843
+ expect ( mockAccessStudioAI ) . not . to . be . called
840
844
841
845
expect ( browsers . connectProtocolToBrowser ) . not . to . be . called
842
846
expect ( this . project [ '_protocolManager' ] ) . to . be . undefined
843
847
} )
844
848
845
- it ( 'passes onStudioInit callback with llm disabled' , async function ( ) {
849
+ it ( 'passes onStudioInit callback with AI disabled' , async function ( ) {
846
850
const mockSetupProtocol = sinon . stub ( )
847
851
const mockBeforeSpec = sinon . stub ( )
848
- const mockAccessStudioLLM = sinon . stub ( ) . resolves ( false )
852
+ const mockAccessStudioAI = sinon . stub ( ) . resolves ( false )
849
853
850
854
this . project . spec = { }
851
855
this . project . ctx . coreData . studio = {
852
- canAccessStudioAI : mockAccessStudioLLM ,
856
+ canAccessStudioAI : mockAccessStudioAI ,
853
857
protocolManager : {
854
858
setupProtocol : mockSetupProtocol ,
855
859
beforeSpec : mockBeforeSpec ,
@@ -887,9 +891,11 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
887
891
888
892
it ( 'passes onStudioDestroy callback' , async function ( ) {
889
893
const mockClose = sinon . stub ( )
894
+ const mockDestroy = sinon . stub ( ) . resolves ( )
890
895
891
896
this . project . ctx . coreData . studio = {
892
897
protocolManager : { } ,
898
+ destroy : mockDestroy ,
893
899
}
894
900
895
901
sinon . stub ( browsers , 'closeProtocolConnection' ) . resolves ( )
@@ -928,7 +934,7 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
928
934
} )
929
935
930
936
expect ( mockClose ) . to . be . calledOnce
931
-
937
+ expect ( mockDestroy ) . to . be . calledOnce
932
938
expect ( this . project [ '_protocolManager' ] ) . to . be . undefined
933
939
} )
934
940
} )
0 commit comments