Skip to content

Commit d223098

Browse files
chore: added a few more tests
1 parent 3e57858 commit d223098

File tree

2 files changed

+37
-21
lines changed

2 files changed

+37
-21
lines changed

tests/integration/tools/mongodb/create/insertMany.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ describeWithMongoDB("insertMany tool when search is disabled", (integration) =>
109109
describeWithMongoDB(
110110
"insertMany tool when search is enabled",
111111
(integration) => {
112-
// let provider: NodeDriverServiceProvider;
113112
let collection: Collection;
114113

115114
beforeEach(async () => {

tests/integration/tools/mongodb/delete/dropIndex.test.ts

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -343,28 +343,45 @@ describe.each([{ vectorSearchEnabled: false }, { vectorSearchEnabled: true }])(
343343
(integration) => {
344344
const { getIndexName } = setupForVectorSearchIndexes(integration);
345345

346-
describe("and attempting to delete a non-existent index", () => {
347-
it("should fail with appropriate error", async () => {
348-
const response = await integration.mcpClient().callTool({
349-
name: "drop-index",
350-
arguments: {
351-
database: "any",
352-
collection: "foo",
353-
indexName: "non-existent",
354-
type: "search",
355-
},
356-
});
357-
expect(response.isError).toBe(true);
358-
const content = getResponseContent(response.content);
359-
expect(content).toContain("Index does not exist in the provided namespace.");
346+
describe.each([
347+
{
348+
title: "an index from non-existent database",
349+
database: "non-existent-db",
350+
collection: "non-existent-coll",
351+
indexName: "non-existent-index",
352+
},
353+
{
354+
title: "an index from non-existent collection",
355+
database: "mflix",
356+
collection: "non-existent-coll",
357+
indexName: "non-existent-index",
358+
},
359+
{
360+
title: "a non-existent index",
361+
database: "mflix",
362+
collection: "movies",
363+
indexName: "non-existent-index",
364+
},
365+
])(
366+
"and attempting to delete $title (namespace - $database $collection)",
367+
({ database, collection, indexName }) => {
368+
it("should fail with appropriate error", async () => {
369+
const response = await integration.mcpClient().callTool({
370+
name: "drop-index",
371+
arguments: { database, collection, indexName, type: "search" },
372+
});
373+
expect(response.isError).toBe(true);
374+
const content = getResponseContent(response.content);
375+
expect(content).toContain("Index does not exist in the provided namespace.");
360376

361-
const data = getDataFromUntrustedContent(content);
362-
expect(JSON.parse(data)).toMatchObject({
363-
indexName: "non-existent",
364-
namespace: "any.foo",
377+
const data = getDataFromUntrustedContent(content);
378+
expect(JSON.parse(data)).toMatchObject({
379+
indexName,
380+
namespace: `${database}.${collection}`,
381+
});
365382
});
366-
});
367-
});
383+
}
384+
);
368385

369386
describe("and attempting to delete an existing index", () => {
370387
it("should succeed in deleting the index", async () => {

0 commit comments

Comments
 (0)