• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 14618487127

23 Apr 2025 12:45PM UTC coverage: 78.42% (+1.7%) from 76.675%
14618487127

Pull #91

github

nirinchev
PR comments
Pull Request #91: chore: add tests for metadata actions

90 of 161 branches covered (55.9%)

Branch coverage included in aggregate %.

22 of 23 new or added lines in 4 files covered. (95.65%)

30 existing lines in 12 files now uncovered.

575 of 687 relevant lines covered (83.7%)

30.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/src/session.ts
1
import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver";
2
import { ApiClient } from "./common/atlas/apiClient.js";
18✔
3
import config from "./config.js";
18✔
4

5
export class Session {
18✔
6
    serviceProvider?: NodeDriverServiceProvider;
7
    apiClient?: ApiClient;
8

9
    ensureAuthenticated(): asserts this is { apiClient: ApiClient } {
10
        if (!this.apiClient) {
11
            if (!config.apiClientId || !config.apiClientSecret) {
18!
12
                throw new Error(
13
                    "Not authenticated make sure to configure MCP server with MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET environment variables."
14
                );
15
            }
16

17
            this.apiClient = new ApiClient({
18
                baseUrl: config.apiBaseUrl,
18✔
19
                credentials: {
20
                    clientId: config.apiClientId,
21
                    clientSecret: config.apiClientSecret,
22
                },
23
            });
24
        }
25
    }
170✔
26

101✔
27
    async close(): Promise<void> {
101✔
28
        if (this.serviceProvider) {
UNCOV
29
            try {
×
30
                await this.serviceProvider.close(true);
31
            } catch (error) {
101✔
32
                console.error("Error closing service provider:", error);
33
            }
34
            this.serviceProvider = undefined;
35
        }
36
    }
37
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc