11import {
2- defaultDriverOptions ,
3- defaultTestConfig ,
42 expectDefined ,
53 getResponseElements ,
6- setupIntegrationTest ,
74} from "../../helpers.js" ;
8- import { afterEach , describe , expect , it } from "vitest" ;
5+ import { afterEach , expect , it } from "vitest" ;
6+ import { describeWithAtlasLocal , describeWithAtlasLocalDisabled } from "./atlasLocalHelpers.js" ;
97
10- const isMacOSInGitHubActions = process . platform === "darwin" && process . env . GITHUB_ACTIONS === "true" ;
11-
12- // Docker is not available on macOS in GitHub Actions
13- // That's why we skip the tests on macOS in GitHub Actions
14- describe ( "atlas-local-create-deployment" , ( ) => {
8+ describeWithAtlasLocal ( "atlas-local-create-deployment" , ( integration ) => {
159 let deploymentNamesToCleanup : string [ ] = [ ] ;
1610
1711 afterEach ( async ( ) => {
@@ -28,27 +22,14 @@ describe("atlas-local-create-deployment", () => {
2822 }
2923 deploymentNamesToCleanup = [ ] ;
3024 } ) ;
31- const integration = setupIntegrationTest (
32- ( ) => defaultTestConfig ,
33- ( ) => defaultDriverOptions
34- ) ;
3525
36- it . skipIf ( isMacOSInGitHubActions ) ( "should have the atlas-local-create-deployment tool" , async ( ) => {
26+ it ( "should have the atlas-local-create-deployment tool" , async ( ) => {
3727 const { tools } = await integration . mcpClient ( ) . listTools ( ) ;
3828 const createDeployment = tools . find ( ( tool ) => tool . name === "atlas-local-create-deployment" ) ;
3929 expectDefined ( createDeployment ) ;
4030 } ) ;
4131
42- it . skipIf ( ! isMacOSInGitHubActions ) (
43- "[MacOS in GitHub Actions] should not have the atlas-local-create-deployment tool" ,
44- async ( ) => {
45- const { tools } = await integration . mcpClient ( ) . listTools ( ) ;
46- const createDeployment = tools . find ( ( tool ) => tool . name === "atlas-local-create-deployment" ) ;
47- expect ( createDeployment ) . toBeUndefined ( ) ;
48- }
49- ) ;
50-
51- it . skipIf ( isMacOSInGitHubActions ) ( "should have correct metadata" , async ( ) => {
32+ it ( "should have correct metadata" , async ( ) => {
5233 const { tools } = await integration . mcpClient ( ) . listTools ( ) ;
5334 const createDeployment = tools . find ( ( tool ) => tool . name === "atlas-local-create-deployment" ) ;
5435 expectDefined ( createDeployment ) ;
@@ -57,7 +38,7 @@ describe("atlas-local-create-deployment", () => {
5738 expect ( createDeployment . inputSchema . properties ) . toHaveProperty ( "deploymentName" ) ;
5839 } ) ;
5940
60- it . skipIf ( isMacOSInGitHubActions ) ( "should create a deployment when calling the tool" , async ( ) => {
41+ it ( "should create a deployment when calling the tool" , async ( ) => {
6142 const deploymentName = `test-deployment-${ Date . now ( ) } ` ;
6243
6344 // Check that deployment doesn't exist before creation
@@ -83,33 +64,31 @@ describe("atlas-local-create-deployment", () => {
8364 } ) ;
8465
8566 const afterElements = getResponseElements ( afterResponse . content ) ;
86- expect ( afterElements . length ) . toBeGreaterThanOrEqual ( 1 ) ;
67+ expect ( afterElements ) . toHaveLength ( 2 ) ;
8768 expect ( afterElements [ 1 ] ?. text ?? "" ) . toContain ( deploymentName ) ;
8869 } ) ;
8970
90- it . skipIf ( isMacOSInGitHubActions ) (
91- "should return an error when creating a deployment that already exists" ,
92- async ( ) => {
93- // Create a deployment
94- const deploymentName = `test-deployment-${ Date . now ( ) } ` ;
95- deploymentNamesToCleanup . push ( deploymentName ) ;
96- await integration . mcpClient ( ) . callTool ( {
97- name : "atlas-local-create-deployment" ,
98- arguments : { deploymentName } ,
99- } ) ;
100-
101- // Try to create the same deployment again
102- const response = await integration . mcpClient ( ) . callTool ( {
103- name : "atlas-local-create-deployment" ,
104- arguments : { deploymentName } ,
105- } ) ;
106- const elements = getResponseElements ( response . content ) ;
107- expect ( elements . length ) . toBeGreaterThanOrEqual ( 1 ) ;
108- expect ( elements [ 0 ] ?. text ) . toContain ( "Container already exists: " + deploymentName ) ;
109- }
110- ) ;
71+ it ( "should return an error when creating a deployment that already exists" , async ( ) => {
72+ // Create a deployment
73+ const deploymentName = `test-deployment-${ Date . now ( ) } ` ;
74+ deploymentNamesToCleanup . push ( deploymentName ) ;
75+ await integration . mcpClient ( ) . callTool ( {
76+ name : "atlas-local-create-deployment" ,
77+ arguments : { deploymentName } ,
78+ } ) ;
11179
112- it . skipIf ( isMacOSInGitHubActions ) ( "should create a deployment with the correct name" , async ( ) => {
80+ // Try to create the same deployment again
81+ const response = await integration . mcpClient ( ) . callTool ( {
82+ name : "atlas-local-create-deployment" ,
83+ arguments : { deploymentName } ,
84+ } ) ;
85+ expect ( response . isError ) . toBe ( true ) ;
86+ const elements = getResponseElements ( response . content ) ;
87+ expect ( elements ) . toHaveLength ( 1 ) ;
88+ expect ( elements [ 0 ] ?. text ) . toContain ( "Container already exists: " + deploymentName ) ;
89+ } ) ;
90+
91+ it ( "should create a deployment with the correct name" , async ( ) => {
11392 // Create a deployment
11493 const deploymentName = `test-deployment-${ Date . now ( ) } ` ;
11594 deploymentNamesToCleanup . push ( deploymentName ) ;
@@ -135,7 +114,7 @@ describe("atlas-local-create-deployment", () => {
135114 expect ( elements [ 1 ] ?. text ?? "" ) . toContain ( "Running" ) ;
136115 } ) ;
137116
138- it . skipIf ( isMacOSInGitHubActions ) ( "should create a deployment when name is not provided" , async ( ) => {
117+ it ( "should create a deployment when name is not provided" , async ( ) => {
139118 // Create a deployment
140119 const createResponse = await integration . mcpClient ( ) . callTool ( {
141120 name : "atlas-local-create-deployment" ,
@@ -165,3 +144,11 @@ describe("atlas-local-create-deployment", () => {
165144 expect ( elements [ 1 ] ?. text ?? "" ) . toContain ( "Running" ) ;
166145 } ) ;
167146} ) ;
147+
148+ describeWithAtlasLocalDisabled ( "[MacOS in GitHub Actions] atlas-local-create-deployment" , ( integration ) => {
149+ it ( "should not have the atlas-local-create-deployment tool" , async ( ) => {
150+ const { tools } = await integration . mcpClient ( ) . listTools ( ) ;
151+ const createDeployment = tools . find ( ( tool ) => tool . name === "atlas-local-create-deployment" ) ;
152+ expect ( createDeployment ) . toBeUndefined ( ) ;
153+ } ) ;
154+ } ) ;
0 commit comments