@@ -178,119 +178,4 @@ describe("Config", () => {
178178 expect ( workspace . createdAt ) . toBe ( "2025-01-01T00:00:00.000Z" ) ;
179179 } ) ;
180180 } ) ;
181-
182- describe ( "workspace MCP overrides" , ( ) => {
183- it ( "should return undefined for non-existent workspace" , ( ) => {
184- const result = config . getWorkspaceMCPOverrides ( "non-existent-id" ) ;
185- expect ( result ) . toBeUndefined ( ) ;
186- } ) ;
187-
188- it ( "should return undefined for workspace without MCP overrides" , async ( ) => {
189- const projectPath = "/fake/project" ;
190- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
191-
192- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
193-
194- await config . editConfig ( ( cfg ) => {
195- cfg . projects . set ( projectPath , {
196- workspaces : [ { path : workspacePath , id : "test-ws-id" , name : "branch" } ] ,
197- } ) ;
198- return cfg ;
199- } ) ;
200-
201- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
202- expect ( result ) . toBeUndefined ( ) ;
203- } ) ;
204-
205- it ( "should set and get MCP overrides for a workspace" , async ( ) => {
206- const projectPath = "/fake/project" ;
207- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
208-
209- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
210-
211- await config . editConfig ( ( cfg ) => {
212- cfg . projects . set ( projectPath , {
213- workspaces : [ { path : workspacePath , id : "test-ws-id" , name : "branch" } ] ,
214- } ) ;
215- return cfg ;
216- } ) ;
217-
218- // Set overrides
219- await config . setWorkspaceMCPOverrides ( "test-ws-id" , {
220- disabledServers : [ "server-a" , "server-b" ] ,
221- toolAllowlist : { "server-c" : [ "tool1" , "tool2" ] } ,
222- } ) ;
223-
224- // Get overrides
225- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
226- expect ( result ) . toBeDefined ( ) ;
227- expect ( result ! . disabledServers ) . toEqual ( [ "server-a" , "server-b" ] ) ;
228- expect ( result ! . toolAllowlist ) . toEqual ( { "server-c" : [ "tool1" , "tool2" ] } ) ;
229- } ) ;
230-
231- it ( "should remove MCP overrides when set to empty" , async ( ) => {
232- const projectPath = "/fake/project" ;
233- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
234-
235- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
236-
237- await config . editConfig ( ( cfg ) => {
238- cfg . projects . set ( projectPath , {
239- workspaces : [
240- {
241- path : workspacePath ,
242- id : "test-ws-id" ,
243- name : "branch" ,
244- mcp : { disabledServers : [ "server-a" ] } ,
245- } ,
246- ] ,
247- } ) ;
248- return cfg ;
249- } ) ;
250-
251- // Clear overrides
252- await config . setWorkspaceMCPOverrides ( "test-ws-id" , { } ) ;
253-
254- // Verify overrides are removed
255- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
256- expect ( result ) . toBeUndefined ( ) ;
257-
258- // Verify workspace still exists
259- const configData = config . loadConfigOrDefault ( ) ;
260- const projectConfig = configData . projects . get ( projectPath ) ;
261- expect ( projectConfig ! . workspaces [ 0 ] . id ) . toBe ( "test-ws-id" ) ;
262- expect ( projectConfig ! . workspaces [ 0 ] . mcp ) . toBeUndefined ( ) ;
263- } ) ;
264-
265- it ( "should deduplicate disabledServers" , async ( ) => {
266- const projectPath = "/fake/project" ;
267- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
268-
269- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
270-
271- await config . editConfig ( ( cfg ) => {
272- cfg . projects . set ( projectPath , {
273- workspaces : [ { path : workspacePath , id : "test-ws-id" , name : "branch" } ] ,
274- } ) ;
275- return cfg ;
276- } ) ;
277-
278- // Set with duplicates
279- await config . setWorkspaceMCPOverrides ( "test-ws-id" , {
280- disabledServers : [ "server-a" , "server-b" , "server-a" ] ,
281- } ) ;
282-
283- // Verify duplicates are removed
284- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
285- expect ( result ! . disabledServers ) . toHaveLength ( 2 ) ;
286- expect ( result ! . disabledServers ) . toContain ( "server-a" ) ;
287- expect ( result ! . disabledServers ) . toContain ( "server-b" ) ;
288- } ) ;
289-
290- it ( "should throw error when setting overrides for non-existent workspace" , async ( ) => {
291- await expect (
292- config . setWorkspaceMCPOverrides ( "non-existent-id" , { disabledServers : [ "server-a" ] } )
293- ) . rejects . toThrow ( "Workspace non-existent-id not found in config" ) ;
294- } ) ;
295- } ) ;
296181} ) ;
0 commit comments