Skip to content

Commit b258484

Browse files
Add mocked tests
1 parent df8201e commit b258484

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

tests/accuracy/createDeployment.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
2+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
23

34
describeAccuracyTests([
45
{
@@ -58,4 +59,24 @@ describeAccuracyTests([
5859
},
5960
],
6061
},
62+
{
63+
prompt: "If and only if, the local MongoDB deployment 'existing-database' does not exist, then create it",
64+
mockedTools: {
65+
"atlas-local-list-deployments": (): CallToolResult => ({
66+
content: [
67+
{ type: "text", text: "Found 1 deployment:" },
68+
{
69+
type: "text",
70+
text: "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\nexisting-database | Running | 6.0",
71+
},
72+
],
73+
}),
74+
},
75+
expectedToolCalls: [
76+
{
77+
toolName: "atlas-local-list-deployments",
78+
parameters: {},
79+
},
80+
],
81+
},
6182
]);

tests/accuracy/deleteDeployment.test.ts

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
2+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
23

34
describeAccuracyTests([
45
{
@@ -25,22 +26,60 @@ describeAccuracyTests([
2526
},
2627
{
2728
prompt: "Delete all my local MongoDB instances",
29+
mockedTools: {
30+
"atlas-local-list-deployments": (): CallToolResult => ({
31+
content: [
32+
{ type: "text", text: "Found 1 deployment:" },
33+
{
34+
type: "text",
35+
text: "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\nlocal-mflix | Running | 6.0\nlocal-comics | Running | 6.0",
36+
},
37+
],
38+
}),
39+
},
2840
expectedToolCalls: [
2941
{
3042
toolName: "atlas-local-list-deployments",
3143
parameters: {},
3244
},
33-
// There is none, so no delete call
45+
{
46+
toolName: "atlas-local-delete-deployment",
47+
parameters: {
48+
deploymentName: "local-mflix",
49+
},
50+
},
51+
{
52+
toolName: "atlas-local-delete-deployment",
53+
parameters: {
54+
deploymentName: "local-comics",
55+
},
56+
},
3457
],
3558
},
3659
{
3760
prompt: "If and only if, the local MongoDB deployment 'local-mflix' exists, then delete it",
61+
mockedTools: {
62+
"atlas-local-list-deployments": (): CallToolResult => ({
63+
content: [
64+
{ type: "text", text: "Found 1 deployment:" },
65+
{
66+
type: "text",
67+
text: "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\nlocal-mflix | Running | 6.0",
68+
},
69+
],
70+
}),
71+
},
3872
expectedToolCalls: [
3973
{
4074
toolName: "atlas-local-list-deployments",
4175
parameters: {},
4276
},
43-
// There doesn't exist one so no delete call
77+
{
78+
toolName: "atlas-local-delete-deployment",
79+
parameters: {
80+
deploymentName: "local-mflix",
81+
},
82+
},
4483
],
4584
},
4685
{

0 commit comments

Comments
 (0)