fix(tests): type config-handler test spy restore
Avoid for the MCP env allowlist spy restore path so the config-handler test keeps the same behavior with specific typing. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -31,6 +31,8 @@ function createPluginConfig(overrides: Partial<OhMyOpenCodeConfig> = {}): OhMyOp
|
||||
}
|
||||
}
|
||||
|
||||
let setAdditionalAllowedMcpEnvVarsSpy: ReturnType<typeof spyOn> | undefined
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(agents, "createBuiltinAgents" as any).mockResolvedValue({
|
||||
sisyphus: { name: "sisyphus", prompt: "test", mode: "primary" },
|
||||
@@ -57,7 +59,7 @@ beforeEach(() => {
|
||||
spyOn(agentLoader, "loadProjectAgents" as any).mockReturnValue({})
|
||||
|
||||
spyOn(mcpLoader, "loadMcpConfigs" as any).mockResolvedValue({ servers: {} })
|
||||
spyOn(mcpLoader, "setAdditionalAllowedMcpEnvVars").mockImplementation(() => {})
|
||||
setAdditionalAllowedMcpEnvVarsSpy = spyOn(mcpLoader, "setAdditionalAllowedMcpEnvVars").mockImplementation(() => {})
|
||||
|
||||
spyOn(pluginLoader, "loadAllPluginComponents" as any).mockResolvedValue({
|
||||
commands: {},
|
||||
@@ -104,7 +106,7 @@ afterEach(() => {
|
||||
;(agentLoader.loadUserAgents as any)?.mockRestore?.()
|
||||
;(agentLoader.loadProjectAgents as any)?.mockRestore?.()
|
||||
;(mcpLoader.loadMcpConfigs as any)?.mockRestore?.()
|
||||
;(mcpLoader.setAdditionalAllowedMcpEnvVars as any)?.mockRestore?.()
|
||||
setAdditionalAllowedMcpEnvVarsSpy?.mockRestore()
|
||||
;(pluginLoader.loadAllPluginComponents as any)?.mockRestore?.()
|
||||
;(mcpModule.createBuiltinMcps as any)?.mockRestore?.()
|
||||
;(shared.log as any)?.mockRestore?.()
|
||||
|
||||
Reference in New Issue
Block a user