|
1 | 1 | import { expectDefined, getDataFromUntrustedContent, getResponseElements } from "../../helpers.js"; |
2 | | -import { parseTable, describeWithAtlas } from "./atlasHelpers.js"; |
| 2 | +import { parseTable, describeWithAtlas, withCredentials } from "./atlasHelpers.js"; |
3 | 3 | import { describe, expect, it } from "vitest"; |
4 | 4 |
|
5 | 5 | describeWithAtlas("orgs", (integration) => { |
6 | | - describe("atlas-list-orgs", () => { |
7 | | - it("should have correct metadata", async () => { |
8 | | - const { tools } = await integration.mcpClient().listTools(); |
9 | | - const listOrgs = tools.find((tool) => tool.name === "atlas-list-orgs"); |
10 | | - expectDefined(listOrgs); |
11 | | - }); |
| 6 | + withCredentials(integration, () => { |
| 7 | + describe("atlas-list-orgs", () => { |
| 8 | + it("should have correct metadata", async () => { |
| 9 | + const { tools } = await integration.mcpClient().listTools(); |
| 10 | + const listOrgs = tools.find((tool) => tool.name === "atlas-list-orgs"); |
| 11 | + expectDefined(listOrgs); |
| 12 | + }); |
12 | 13 |
|
13 | | - it("returns org names", async () => { |
14 | | - const response = await integration.mcpClient().callTool({ name: "atlas-list-orgs", arguments: {} }); |
15 | | - const elements = getResponseElements(response); |
16 | | - expect(elements[0]?.text).toContain("Found 1 organizations"); |
17 | | - expect(elements[1]?.text).toContain("<untrusted-user-data-"); |
18 | | - const data = parseTable(getDataFromUntrustedContent(elements[1]?.text ?? "")); |
19 | | - expect(data).toHaveLength(1); |
20 | | - expect(data[0]?.["Organization Name"]).toEqual("MongoDB MCP Test"); |
| 14 | + it("returns org names", async () => { |
| 15 | + const response = await integration.mcpClient().callTool({ name: "atlas-list-orgs", arguments: {} }); |
| 16 | + const elements = getResponseElements(response); |
| 17 | + expect(elements[0]?.text).toContain("Found 1 organizations"); |
| 18 | + expect(elements[1]?.text).toContain("<untrusted-user-data-"); |
| 19 | + const data = parseTable(getDataFromUntrustedContent(elements[1]?.text ?? "")); |
| 20 | + expect(data).toHaveLength(1); |
| 21 | + expect(data[0]?.["Organization Name"]).toEqual("MongoDB MCP Test"); |
| 22 | + }); |
21 | 23 | }); |
22 | 24 | }); |
23 | 25 | }); |
0 commit comments