@@ -148,119 +148,4 @@ describe("Config", () => {
148148 expect ( workspace . createdAt ) . toBe ( "2025-01-01T00:00:00.000Z" ) ;
149149 } ) ;
150150 } ) ;
151-
152- describe ( "workspace MCP overrides" , ( ) => {
153- it ( "should return undefined for non-existent workspace" , ( ) => {
154- const result = config . getWorkspaceMCPOverrides ( "non-existent-id" ) ;
155- expect ( result ) . toBeUndefined ( ) ;
156- } ) ;
157-
158- it ( "should return undefined for workspace without MCP overrides" , async ( ) => {
159- const projectPath = "/fake/project" ;
160- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
161-
162- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
163-
164- await config . editConfig ( ( cfg ) => {
165- cfg . projects . set ( projectPath , {
166- workspaces : [ { path : workspacePath , id : "test-ws-id" , name : "branch" } ] ,
167- } ) ;
168- return cfg ;
169- } ) ;
170-
171- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
172- expect ( result ) . toBeUndefined ( ) ;
173- } ) ;
174-
175- it ( "should set and get MCP overrides for a workspace" , async ( ) => {
176- const projectPath = "/fake/project" ;
177- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
178-
179- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
180-
181- await config . editConfig ( ( cfg ) => {
182- cfg . projects . set ( projectPath , {
183- workspaces : [ { path : workspacePath , id : "test-ws-id" , name : "branch" } ] ,
184- } ) ;
185- return cfg ;
186- } ) ;
187-
188- // Set overrides
189- await config . setWorkspaceMCPOverrides ( "test-ws-id" , {
190- disabledServers : [ "server-a" , "server-b" ] ,
191- toolAllowlist : { "server-c" : [ "tool1" , "tool2" ] } ,
192- } ) ;
193-
194- // Get overrides
195- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
196- expect ( result ) . toBeDefined ( ) ;
197- expect ( result ! . disabledServers ) . toEqual ( [ "server-a" , "server-b" ] ) ;
198- expect ( result ! . toolAllowlist ) . toEqual ( { "server-c" : [ "tool1" , "tool2" ] } ) ;
199- } ) ;
200-
201- it ( "should remove MCP overrides when set to empty" , async ( ) => {
202- const projectPath = "/fake/project" ;
203- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
204-
205- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
206-
207- await config . editConfig ( ( cfg ) => {
208- cfg . projects . set ( projectPath , {
209- workspaces : [
210- {
211- path : workspacePath ,
212- id : "test-ws-id" ,
213- name : "branch" ,
214- mcp : { disabledServers : [ "server-a" ] } ,
215- } ,
216- ] ,
217- } ) ;
218- return cfg ;
219- } ) ;
220-
221- // Clear overrides
222- await config . setWorkspaceMCPOverrides ( "test-ws-id" , { } ) ;
223-
224- // Verify overrides are removed
225- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
226- expect ( result ) . toBeUndefined ( ) ;
227-
228- // Verify workspace still exists
229- const configData = config . loadConfigOrDefault ( ) ;
230- const projectConfig = configData . projects . get ( projectPath ) ;
231- expect ( projectConfig ! . workspaces [ 0 ] . id ) . toBe ( "test-ws-id" ) ;
232- expect ( projectConfig ! . workspaces [ 0 ] . mcp ) . toBeUndefined ( ) ;
233- } ) ;
234-
235- it ( "should deduplicate disabledServers" , async ( ) => {
236- const projectPath = "/fake/project" ;
237- const workspacePath = path . join ( config . srcDir , "project" , "branch" ) ;
238-
239- fs . mkdirSync ( workspacePath , { recursive : true } ) ;
240-
241- await config . editConfig ( ( cfg ) => {
242- cfg . projects . set ( projectPath , {
243- workspaces : [ { path : workspacePath , id : "test-ws-id" , name : "branch" } ] ,
244- } ) ;
245- return cfg ;
246- } ) ;
247-
248- // Set with duplicates
249- await config . setWorkspaceMCPOverrides ( "test-ws-id" , {
250- disabledServers : [ "server-a" , "server-b" , "server-a" ] ,
251- } ) ;
252-
253- // Verify duplicates are removed
254- const result = config . getWorkspaceMCPOverrides ( "test-ws-id" ) ;
255- expect ( result ! . disabledServers ) . toHaveLength ( 2 ) ;
256- expect ( result ! . disabledServers ) . toContain ( "server-a" ) ;
257- expect ( result ! . disabledServers ) . toContain ( "server-b" ) ;
258- } ) ;
259-
260- it ( "should throw error when setting overrides for non-existent workspace" , async ( ) => {
261- await expect (
262- config . setWorkspaceMCPOverrides ( "non-existent-id" , { disabledServers : [ "server-a" ] } )
263- ) . rejects . toThrow ( "Workspace non-existent-id not found in config" ) ;
264- } ) ;
265- } ) ;
266151} ) ;
0 commit comments