Skip to content

Commit 22d3680

Browse files
committed
fix: tests
1 parent a724461 commit 22d3680

File tree

5 files changed

+7
-21
lines changed

5 files changed

+7
-21
lines changed

tests/integration/tools/atlas/accessLists.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2-
import { Session } from "../../../../src/session.js";
32
import { describeAtlas, withProject } from "./atlasHelpers.js";
43

54
function generateRandomIp() {
@@ -17,20 +16,18 @@ describeAtlas("ip access lists", (integration) => {
1716
const values = [...ips, ...cidrBlocks];
1817

1918
beforeAll(async () => {
20-
const session: Session = integration.mcpServer().session;
21-
session.ensureAuthenticated();
22-
const ipInfo = await session.apiClient.getIpInfo();
19+
const apiClient = integration.mcpServer().session.apiClient;
20+
const ipInfo = await apiClient.getIpInfo();
2321
values.push(ipInfo.currentIpv4Address);
2422
});
2523

2624
afterAll(async () => {
27-
const session: Session = integration.mcpServer().session;
28-
session.ensureAuthenticated();
25+
const apiClient = integration.mcpServer().session.apiClient;
2926

3027
const projectId = getProjectId();
3128

3229
for (const value of values) {
33-
await session.apiClient.deleteProjectIpAccessList({
30+
await apiClient.deleteProjectIpAccessList({
3431
params: {
3532
path: {
3633
groupId: projectId,

tests/integration/tools/atlas/atlasHelpers.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ObjectId } from "mongodb";
22
import { Group } from "../../../../src/common/atlas/openapi.js";
33
import { ApiClient } from "../../../../src/common/atlas/apiClient.js";
44
import { setupIntegrationTest, IntegrationTest } from "../../helpers.js";
5-
import { Session } from "../../../../src/session.js";
65

76
export type IntegrationTestFunction = (integration: IntegrationTest) => void;
87

@@ -35,19 +34,15 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio
3534
let projectId: string = "";
3635

3736
beforeAll(async () => {
38-
const session: Session = integration.mcpServer().session;
39-
session.ensureAuthenticated();
37+
const apiClient = integration.mcpServer().session.apiClient;
4038

41-
const apiClient = session.apiClient;
4239
const group = await createProject(apiClient);
4340
projectId = group.id || "";
4441
});
4542

4643
afterAll(async () => {
47-
const session: Session = integration.mcpServer().session;
48-
session.ensureAuthenticated();
44+
const apiClient = integration.mcpServer().session.apiClient;
4945

50-
const apiClient = session.apiClient;
5146
await apiClient.deleteProject({
5247
params: {
5348
path: {

tests/integration/tools/atlas/clusters.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { describeAtlas, withProject, sleep, randomId } from "./atlasHelpers.js";
33
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
44

55
async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string) {
6-
session.ensureAuthenticated();
7-
86
await session.apiClient.deleteCluster({
97
params: {
108
path: {

tests/integration/tools/atlas/dbUsers.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ describeAtlas("db users", (integration) => {
99
const projectId = getProjectId();
1010

1111
const session: Session = integration.mcpServer().session;
12-
session.ensureAuthenticated();
1312
await session.apiClient.deleteDatabaseUser({
1413
params: {
1514
path: {

tests/integration/tools/atlas/projects.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2-
import { setupIntegrationTest } from "../../helpers.js";
3-
import { Session } from "../../../../src/session.js";
42
import { ObjectId } from "mongodb";
53
import { parseTable, describeAtlas } from "./atlasHelpers.js";
64

@@ -10,8 +8,7 @@ describeAtlas("projects", (integration) => {
108
const projName = "testProj-" + randomId;
119

1210
afterAll(async () => {
13-
const session: Session = integration.mcpServer().session;
14-
session.ensureAuthenticated();
11+
const session = integration.mcpServer().session;
1512

1613
const projects = await session.apiClient.listProjects();
1714
for (const project of projects?.results || []) {

0 commit comments

Comments
 (0)