Skip to content

Commit 1a3bffa

Browse files
Add expect default for empty list of deployments
1 parent 6ee6636 commit 1a3bffa

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/integration/tools/atlas-local/createDeployment.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ describe("atlas-local-create-deployment", () => {
7474
arguments: {},
7575
});
7676
const beforeElements = getResponseElements(beforeResponse.content);
77+
expect(beforeElements.length).toBeGreaterThanOrEqual(1);
7778
expect(beforeElements[1]?.text ?? "").not.toContain(deploymentName);
7879

7980
// Create a deployment
@@ -91,7 +92,7 @@ describe("atlas-local-create-deployment", () => {
9192

9293
const afterElements = getResponseElements(afterResponse.content);
9394
expect(afterElements.length).toBeGreaterThanOrEqual(1);
94-
expect(afterElements[1]?.text).toContain(deploymentName);
95+
expect(afterElements[1]?.text ?? "").toContain(deploymentName);
9596
});
9697

9798
it.skipIf(isMacOSInGitHubActions)(
@@ -137,8 +138,8 @@ describe("atlas-local-create-deployment", () => {
137138
const elements = getResponseElements(response.content);
138139

139140
expect(elements.length).toBeGreaterThanOrEqual(1);
140-
expect(elements[1]?.text).toContain(deploymentName);
141-
expect(elements[1]?.text).toContain("Running");
141+
expect(elements[1]?.text ?? "").toContain(deploymentName);
142+
expect(elements[1]?.text ?? "").toContain("Running");
142143
});
143144

144145
it.skipIf(isMacOSInGitHubActions)("should create a deployment when name is not provided", async ({ signal }) => {
@@ -164,6 +165,6 @@ describe("atlas-local-create-deployment", () => {
164165
const deploymentName = elements[1]?.text.match(/local\d+/)?.[0];
165166
expectDefined(deploymentName);
166167
deploymentNamesToCleanup.push(deploymentName);
167-
expect(elements[1]?.text).toContain("Running");
168+
expect(elements[1]?.text ?? "").toContain("Running");
168169
});
169170
});

tests/integration/tools/atlas-local/deleteDeployment.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ describe("atlas-local-delete-deployment", () => {
8080
arguments: {},
8181
});
8282
const beforeElements = getResponseElements(beforeResponse.content);
83-
expect(beforeElements[1]?.text).toContain(deploymentName);
83+
expect(beforeElements.length).toBeGreaterThanOrEqual(1);
84+
expect(beforeElements[1]?.text ?? "").toContain(deploymentName);
8485

8586
// Delete the deployment
8687
await integration.mcpClient().callTool({

0 commit comments

Comments
 (0)