test: fix CodeIndexManager test mock to provide proper secrets

- Updated mock contextProxy to provide valid secrets for re-initialization
- Ensures the configuration is considered valid during test execution
This commit is contained in:
Roo Code 2025-11-04 06:29:17 +00:00
parent a3a5f4eeac
commit 2e4029e560

View file

@ -527,7 +527,12 @@ describe("CodeIndexManager - handleSettingsChange regression", () => {
getValue: vi.fn(),
setValue: vi.fn(),
storeSecret: vi.fn(),
getSecret: vi.fn(),
getSecret: vi.fn().mockImplementation((key: string) => {
// Return appropriate secret based on key for the config to be valid
if (key === "codeIndexOpenAiKey") return "test-openai-key"
if (key === "codeIndexQdrantApiKey") return "test-qdrant-key"
return ""
}),
refreshSecrets: vi.fn().mockResolvedValue(undefined),
getGlobalState: vi.fn().mockReturnValue({
codebaseIndexEnabled: true,