revert tests

This commit is contained in:
uinstinct 2025-08-07 11:56:28 +05:30
parent 95ded8645b
commit cdc71422a9

View file

@ -710,94 +710,4 @@ describe("CodebaseIndexer", () => {
});
});
});
describe("getIndexesToBuild", () => {
let indexer: CodebaseIndexer;
let mockConfig: any;
let mockEmbeddingsModel: any;
let mockIdeSettings: any;
beforeEach(() => {
indexer = new CodebaseIndexer(
testConfigHandler,
testIde,
mockMessenger as any,
false,
);
mockEmbeddingsModel = {
maxEmbeddingChunkSize: 1000,
model: "test-model",
provider: "test-provider",
};
mockIdeSettings = {
remoteConfigServerUrl: "http://test.com",
userToken: "test-token",
};
mockConfig = {
selectedModelByRole: {
embed: mockEmbeddingsModel,
},
contextProviders: [],
};
jest.spyOn(testIde, "getIdeSettings").mockResolvedValue(mockIdeSettings);
});
afterEach(() => {
jest.clearAllMocks();
});
test("should create specific indexTypes for the requested context providers", async () => {
mockConfig.contextProviders = [
{
description: {
dependsOnIndexing: ["chunk", "codeSnippets"],
},
},
];
jest.spyOn(testConfigHandler, "loadConfig").mockResolvedValue({
config: mockConfig,
errors: [],
configLoadInterrupted: false,
});
const indexes = (await (
indexer as any
).getIndexesToBuild()) as CodebaseIndex[];
expect(indexes).toHaveLength(2);
expect(indexes[0].artifactId).toBe("chunks");
expect(indexes[1].artifactId).toBe("codeSnippets");
});
test("should handle duplicate contexts", async () => {
mockConfig.contextProviders = [
{
description: {
dependsOnIndexing: ["codeSnippets"],
},
},
{
description: {
dependsOnIndexing: ["codeSnippets"],
},
},
];
jest.spyOn(testConfigHandler, "loadConfig").mockResolvedValue({
config: mockConfig,
errors: [],
configLoadInterrupted: false,
});
const indexes = await (indexer as any).getIndexesToBuild();
expect(indexes).toHaveLength(1);
expect(indexes[0].artifactId).toBe("codeSnippets");
});
});
});