Skip to content

Commit d990460

Browse files
chore: move left out test config out of functions
1 parent d110359 commit d990460

File tree

2 files changed

+30
-40
lines changed

2 files changed

+30
-40
lines changed

tests/accuracy/createIndex.test.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
2-
import { AccuracyTestConfig } from "./sdk/describeAccuracyTests.js";
32

4-
function callsCreateIndex(prompt: string, indexKeys: Record<string, unknown>): AccuracyTestConfig {
5-
return {
6-
prompt: prompt,
3+
describeAccuracyTests([
4+
{
5+
prompt: "Create an index that covers the following query on 'mflix.movies' namespace - { \"release_year\": 1992 }",
76
expectedToolCalls: [
87
{
98
toolName: "create-index",
109
parameters: {
1110
database: "mflix",
1211
collection: "movies",
13-
keys: indexKeys,
12+
keys: {
13+
release_year: 1,
14+
},
1415
},
1516
},
1617
],
17-
};
18-
}
19-
20-
describeAccuracyTests([
21-
callsCreateIndex(
22-
"Create an index that covers the following query on 'mflix.movies' namespace - { \"release_year\": 1992 }",
23-
{
24-
release_year: 1,
25-
}
26-
),
27-
callsCreateIndex("Create a text index on title field in 'mflix.movies' namespace", {
28-
title: "text",
29-
}),
18+
},
19+
{
20+
prompt: "Create a text index on title field in 'mflix.movies' namespace",
21+
expectedToolCalls: [
22+
{
23+
toolName: "create-index",
24+
parameters: {
25+
database: "mflix",
26+
collection: "movies",
27+
keys: {
28+
title: "text",
29+
},
30+
},
31+
},
32+
],
33+
},
3034
]);

tests/accuracy/updateMany.test.ts

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
2-
import { AccuracyTestConfig } from "./sdk/describeAccuracyTests.js";
32

4-
function callsUpdateManyWithEmptyFilters(prompt: string): AccuracyTestConfig {
5-
return {
6-
prompt: prompt,
3+
describeAccuracyTests([
4+
{
5+
prompt: "Update all the documents in 'mflix.movies' namespace with a new field 'new_field' set to 1",
76
expectedToolCalls: [
87
{
98
toolName: "update-many",
@@ -18,19 +17,16 @@ function callsUpdateManyWithEmptyFilters(prompt: string): AccuracyTestConfig {
1817
},
1918
},
2019
],
21-
};
22-
}
23-
24-
function callsUpdateManyWithFilters(prompt: string, filter: Record<string, unknown>): AccuracyTestConfig {
25-
return {
26-
prompt: prompt,
20+
},
21+
{
22+
prompt: "Update all the documents in 'mflix.movies' namespace, where runtime is less than 100, with a new field 'new_field' set to 1",
2723
expectedToolCalls: [
2824
{
2925
toolName: "update-many",
3026
parameters: {
3127
database: "mflix",
3228
collection: "movies",
33-
filter,
29+
filter: { runtime: { $lt: 100 } },
3430
update: {
3531
$set: {
3632
new_field: 1,
@@ -39,15 +35,5 @@ function callsUpdateManyWithFilters(prompt: string, filter: Record<string, unkno
3935
},
4036
},
4137
],
42-
};
43-
}
44-
45-
describeAccuracyTests([
46-
callsUpdateManyWithEmptyFilters(
47-
"Update all the documents in 'mflix.movies' namespace with a new field 'new_field' set to 1"
48-
),
49-
callsUpdateManyWithFilters(
50-
"Update all the documents in 'mflix.movies' namespace, where runtime is less than 100, with a new field 'new_field' set to 1",
51-
{ runtime: { $lt: 100 } }
52-
),
38+
},
5339
]);

0 commit comments

Comments
 (0)