Skip to content

Commit ada2e89

Browse files
committed
chore: add atlas tests
1 parent 4c92c52 commit ada2e89

File tree

4 files changed

+60
-7
lines changed

4 files changed

+60
-7
lines changed

.github/workflows/code_health.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ jobs:
2828
runs-on: ${{ matrix.os }}
2929
steps:
3030
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
31-
if: matrix.os != 'windows-latest'
32-
- name: Install keyring deps on Ubuntu
33-
if: matrix.os == 'ubuntu-latest'
34-
run: |
35-
sudo apt update -y
36-
sudo apt install -y gnome-keyring libdbus-1-dev
37-
3831
- uses: actions/checkout@v4
3932
- uses: actions/setup-node@v4
4033
with:

.github/workflows/tests_daily.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Code Health
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
jobs:
9+
run-tests-daily:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version-file: package.json
17+
cache: "npm"
18+
- name: Install dependencies
19+
run: npm ci
20+
- name: Run tests
21+
env:
22+
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
23+
MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }}
24+
MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }}
25+
run: npm test

tests/integration/helpers.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,13 @@ export function validateParameters(tool: ToolInfo, parameters: ParameterInfo[]):
196196
expect(toolParameters).toHaveLength(parameters.length);
197197
expect(toolParameters).toIncludeAllMembers(parameters);
198198
}
199+
200+
201+
export function describeAtlas (name: number | string | Function | jest.FunctionLike, fn: jest.EmptyFunction) {
202+
if (!process.env.MDB_MCP_API_CLIENT_ID?.length || !process.env.MDB_MCP_API_CLIENT_SECRET?.length) {
203+
return describe.skip(name, fn);
204+
}
205+
return describe("atlas", () => {
206+
describe(name, fn);
207+
});
208+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2+
import { jestTestMCPClient, describeAtlas } from "../../helpers.js";
3+
4+
5+
describeAtlas("listProjects tool", () => {
6+
const client = jestTestMCPClient();
7+
8+
it("should have correct metadata", async () => {
9+
const { tools } = await client().listTools();
10+
const listProjects = tools.find((tool) => tool.name === "atlas-list-projects")!;
11+
expect(listProjects).toBeDefined();
12+
expect(listProjects.inputSchema.type).toBe("object");
13+
expect(listProjects.inputSchema.properties).toBeDefined();
14+
15+
const propertyNames = Object.keys(listProjects.inputSchema.properties!);
16+
expect(propertyNames).toHaveLength(0);
17+
});
18+
19+
it("returns project names", async () => {
20+
const response = await client().callTool({ name: "atlas-list-projects", arguments: {} }) as CallToolResult;
21+
expect(response.content).toBeArray();
22+
expect(response.content).toHaveLength(1);
23+
expect(response.content[0].text).toContain("MCP Test");
24+
});
25+
});

0 commit comments

Comments
 (0)