77} from "../../helpers.js" ;
88import { describe , expect , it } from "vitest" ;
99
10- const isMacOSInGitHubActions = process . platform === ' darwin' && process . env . GITHUB_ACTIONS === ' true'
10+ const isMacOSInGitHubActions = process . platform === " darwin" && process . env . GITHUB_ACTIONS === " true" ;
1111
1212describe ( "atlas-local-list-deployments" , ( ) => {
1313 const integration = setupIntegrationTest (
@@ -21,11 +21,14 @@ describe("atlas-local-list-deployments", () => {
2121 expectDefined ( listDeployments ) ;
2222 } ) ;
2323
24- it . skipIf ( ! isMacOSInGitHubActions ) ( "[MacOS in GitHub Actions] should not have the atlas-local-list-deployments tool" , async ( ) => {
25- const { tools } = await integration . mcpClient ( ) . listTools ( ) ;
26- const listDeployments = tools . find ( ( tool ) => tool . name === "atlas-local-list-deployments" ) ;
27- expect ( listDeployments ) . toBeUndefined ( ) ;
28- } ) ;
24+ it . skipIf ( ! isMacOSInGitHubActions ) (
25+ "[MacOS in GitHub Actions] should not have the atlas-local-list-deployments tool" ,
26+ async ( ) => {
27+ const { tools } = await integration . mcpClient ( ) . listTools ( ) ;
28+ const listDeployments = tools . find ( ( tool ) => tool . name === "atlas-local-list-deployments" ) ;
29+ expect ( listDeployments ) . toBeUndefined ( ) ;
30+ }
31+ ) ;
2932
3033 it . skipIf ( isMacOSInGitHubActions ) ( "should have correct metadata" , async ( ) => {
3134 const { tools } = await integration . mcpClient ( ) . listTools ( ) ;
@@ -42,10 +45,17 @@ describe("atlas-local-list-deployments", () => {
4245 arguments : { } ,
4346 } ) ;
4447 const elements = getResponseElements ( response . content ) ;
45- expect ( elements ) . toHaveLength ( 2 ) ;
46- expect ( elements [ 0 ] ?. text ) . toMatch ( / F o u n d \d + d e p l o y m e n t s / ) ;
47- expect ( elements [ 1 ] ?. text ) . toContain (
48- "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\n"
49- ) ;
48+ expect ( elements . length ) . toBeGreaterThanOrEqual ( 1 ) ;
49+
50+ if ( elements . length === 1 ) {
51+ expect ( elements [ 0 ] ?. text ) . toContain ( "No deployments found." ) ;
52+ }
53+
54+ if ( elements . length > 1 ) {
55+ expect ( elements [ 0 ] ?. text ) . toMatch ( / F o u n d \d + d e p l o y m e n t s / ) ;
56+ expect ( elements [ 1 ] ?. text ) . toContain (
57+ "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\n"
58+ ) ;
59+ }
5060 } ) ;
5161} ) ;
0 commit comments