Skip to content

fix: tests #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/integration/tools/atlas/accessLists.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { describeAtlas, withProject } from "./atlasHelpers.js";
import { describeWithAtlas, withProject } from "./atlasHelpers.js";

function generateRandomIp() {
const randomIp: number[] = [192];
Expand All @@ -9,7 +9,7 @@ function generateRandomIp() {
return randomIp.join(".");
}

describeAtlas("ip access lists", (integration) => {
describeWithAtlas("ip access lists", (integration) => {
withProject(integration, ({ getProjectId }) => {
const ips = [generateRandomIp(), generateRandomIp()];
const cidrBlocks = [generateRandomIp() + "/16", generateRandomIp() + "/24"];
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/atlas/clusters.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Session } from "../../../../src/session.js";
import { describeAtlas, withProject, sleep, randomId } from "./atlasHelpers.js";
import { describeWithAtlas, withProject, sleep, randomId } from "./atlasHelpers.js";
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";

async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string) {
Expand Down Expand Up @@ -28,7 +28,7 @@ async function deleteAndWaitCluster(session: Session, projectId: string, cluster
}
}

describeAtlas("clusters", (integration) => {
describeWithAtlas("clusters", (integration) => {
withProject(integration, ({ getProjectId }) => {
const clusterName = "ClusterTest-" + randomId;

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/atlas/dbUsers.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { Session } from "../../../../src/session.js";
import { describeAtlas, withProject, randomId } from "./atlasHelpers.js";
import { describeWithAtlas, withProject, randomId } from "./atlasHelpers.js";

describeAtlas("db users", (integration) => {
describeWithAtlas("db users", (integration) => {
const userName = "testuser-" + randomId;
withProject(integration, ({ getProjectId }) => {
afterAll(async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/atlas/orgs.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { setupIntegrationTest } from "../../helpers.js";
import { parseTable, describeAtlas } from "./atlasHelpers.js";
import { parseTable, describeWithAtlas } from "./atlasHelpers.js";

describeAtlas("orgs", (integration) => {
describeWithAtlas("orgs", (integration) => {
describe("atlas-list-orgs", () => {
it("should have correct metadata", async () => {
const { tools } = await integration.mcpClient().listTools();
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/atlas/projects.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { ObjectId } from "mongodb";
import { parseTable, describeAtlas } from "./atlasHelpers.js";
import { parseTable, describeWithAtlas } from "./atlasHelpers.js";

const randomId = new ObjectId().toString();

describeAtlas("projects", (integration) => {
describeWithAtlas("projects", (integration) => {
const projName = "testProj-" + randomId;

afterAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -10,7 +10,7 @@ import {
dbOperationInvalidArgTests,
} from "../../../helpers.js";

describeMongoDB("createCollection tool", (integration) => {
describeWithMongoDB("createCollection tool", (integration) => {
validateToolMetadata(
integration,
"create-collection",
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/mongodb/create/createIndex.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -10,7 +10,7 @@ import {
} from "../../../helpers.js";
import { IndexDirection } from "mongodb";

describeMongoDB("createIndex tool", (integration) => {
describeWithMongoDB("createIndex tool", (integration) => {
validateToolMetadata(integration, "create-index", "Create an index for a collection", [
...dbOperationParameters,
{
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/mongodb/create/insertMany.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -9,7 +9,7 @@ import {
validateThrowsForInvalidArguments,
} from "../../../helpers.js";

describeMongoDB("insertMany tool", (integration) => {
describeWithMongoDB("insertMany tool", (integration) => {
validateToolMetadata(integration, "insert-many", "Insert an array of documents into a MongoDB collection", [
...dbOperationParameters,
{
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/mongodb/delete/deleteMany.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -9,7 +9,7 @@ import {
validateThrowsForInvalidArguments,
} from "../../../helpers.js";

describeMongoDB("deleteMany tool", (integration) => {
describeWithMongoDB("deleteMany tool", (integration) => {
validateToolMetadata(
integration,
"delete-many",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -10,7 +10,7 @@ import {
dbOperationInvalidArgTests,
} from "../../../helpers.js";

describeMongoDB("dropCollection tool", (integration) => {
describeWithMongoDB("dropCollection tool", (integration) => {
validateToolMetadata(
integration,
"drop-collection",
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/mongodb/delete/dropDatabase.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -10,7 +10,7 @@ import {
dbOperationInvalidArgTests,
} from "../../../helpers.js";

describeMongoDB("dropDatabase tool", (integration) => {
describeWithMongoDB("dropDatabase tool", (integration) => {
validateToolMetadata(
integration,
"drop-database",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseElements,
Expand All @@ -14,7 +14,7 @@ import { Document } from "bson";
import { OptionalId } from "mongodb";
import { SimplifiedSchema } from "mongodb-schema";

describeMongoDB("collectionSchema tool", (integration) => {
describeWithMongoDB("collectionSchema tool", (integration) => {
validateToolMetadata(
integration,
"collection-schema",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -11,7 +11,7 @@ import {
} from "../../../helpers.js";
import * as crypto from "crypto";

describeMongoDB("collectionStorageSize tool", (integration) => {
describeWithMongoDB("collectionStorageSize tool", (integration) => {
validateToolMetadata(
integration,
"collection-storage-size",
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/mongodb/metadata/connect.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import { getResponseContent, setupIntegrationTest, validateToolMetadata } from "../../../helpers.js";

import { config } from "../../../../../src/config.js";

describeMongoDB("Connect tool", (integration) => {
describeWithMongoDB("Connect tool", (integration) => {
validateToolMetadata(integration, "connect", "Connect to a MongoDB instance", [
{
name: "options",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseElements,
Expand All @@ -10,7 +10,7 @@ import {
dbOperationInvalidArgTests,
} from "../../../helpers.js";

describeMongoDB("listCollections tool", (integration) => {
describeWithMongoDB("listCollections tool", (integration) => {
validateToolMetadata(integration, "list-collections", "List all collections for a given database", [
{ name: "database", description: "Database name", type: "string", required: true },
]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseElements,
Expand All @@ -8,7 +8,7 @@ import {
} from "../../../helpers.js";
import { toIncludeSameMembers } from "jest-extended";

describeMongoDB("listDatabases tool", (integration) => {
describeWithMongoDB("listDatabases tool", (integration) => {
const defaultDatabases = ["admin", "config", "local"];

it("should have correct metadata", async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tools/mongodb/read/count.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describeMongoDB } from "../mongodbHelpers.js";
import { describeWithMongoDB } from "../mongodbHelpers.js";

import {
getResponseContent,
Expand All @@ -9,7 +9,7 @@ import {
validateThrowsForInvalidArguments,
} from "../../../helpers.js";

describeMongoDB("count tool", (integration) => {
describeWithMongoDB("count tool", (integration) => {
validateToolMetadata(integration, "count", "Gets the number of documents in a MongoDB collection", [
{
name: "query",
Expand Down
Loading