@@ -83,7 +83,7 @@ describe('#setup()', () => {
83
83
expect ( setupResult . basePath . get ( ) ) . toEqual ( '' ) ;
84
84
} ) ;
85
85
86
- it ( 'setup basePath with workspaceId provided in window.location.href' , ( ) => {
86
+ it ( 'setup basePath with workspaceId provided in window.location.href and workspace feature enabled ' , ( ) => {
87
87
const windowSpy = jest . spyOn ( window , 'window' , 'get' ) ;
88
88
windowSpy . mockImplementation (
89
89
( ) =>
@@ -94,12 +94,43 @@ describe('#setup()', () => {
94
94
} as any )
95
95
) ;
96
96
const injectedMetadata = injectedMetadataServiceMock . createSetupContract ( ) ;
97
+ injectedMetadata . getPlugins . mockReturnValueOnce ( [
98
+ {
99
+ id : 'workspace' ,
100
+ plugin : {
101
+ id : 'workspace' ,
102
+ configPath : '' ,
103
+ requiredPlugins : [ ] ,
104
+ optionalPlugins : [ ] ,
105
+ requiredEnginePlugins : { } ,
106
+ requiredBundles : [ ] ,
107
+ } ,
108
+ } ,
109
+ ] ) ;
97
110
const fatalErrors = fatalErrorsServiceMock . createSetupContract ( ) ;
98
111
const httpService = new HttpService ( ) ;
99
112
const setupResult = httpService . setup ( { fatalErrors, injectedMetadata } ) ;
100
113
expect ( setupResult . basePath . get ( ) ) . toEqual ( '/w/workspaceId' ) ;
101
114
windowSpy . mockRestore ( ) ;
102
115
} ) ;
116
+
117
+ it ( 'setup basePath with workspaceId provided in window.location.href but workspace feature disabled' , ( ) => {
118
+ const windowSpy = jest . spyOn ( window , 'window' , 'get' ) ;
119
+ windowSpy . mockImplementation (
120
+ ( ) =>
121
+ ( {
122
+ location : {
123
+ href : 'http://localhost/w/workspaceId/app' ,
124
+ } ,
125
+ } as any )
126
+ ) ;
127
+ const injectedMetadata = injectedMetadataServiceMock . createSetupContract ( ) ;
128
+ const fatalErrors = fatalErrorsServiceMock . createSetupContract ( ) ;
129
+ const httpService = new HttpService ( ) ;
130
+ const setupResult = httpService . setup ( { fatalErrors, injectedMetadata } ) ;
131
+ expect ( setupResult . basePath . get ( ) ) . toEqual ( '' ) ;
132
+ windowSpy . mockRestore ( ) ;
133
+ } ) ;
103
134
} ) ;
104
135
105
136
describe ( '#stop()' , ( ) => {
0 commit comments