Skip to content

Commit af48a4a

Browse files
committed
fix tests
1 parent cb8ebd7 commit af48a4a

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

tests/accuracy/createIndex.test.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describeAccuracyTests(
8080
{
8181
type: "vector",
8282
path: "plotSummary",
83-
numDimensions: 1024,
83+
numDimensions: "1024",
8484
},
8585
],
8686
},
@@ -106,17 +106,19 @@ describeAccuracyTests(
106106
{
107107
type: "vector",
108108
path: "plotSummary",
109-
numDimensions: Matcher.number(
110-
(value) => value % 2 === 0 && value >= 256 && value <= 8192
111-
),
109+
numDimensions: Matcher.string((value) => {
110+
const intValue = parseInt(value);
111+
return intValue % 2 === 0 && intValue >= 256 && intValue <= 8192;
112+
}),
112113
similarity: Matcher.anyOf(Matcher.undefined, Matcher.string()),
113114
},
114115
{
115116
type: "vector",
116117
path: "genre",
117-
numDimensions: Matcher.number(
118-
(value) => value % 2 === 0 && value >= 256 && value <= 8192
119-
),
118+
numDimensions: Matcher.string((value) => {
119+
const intValue = parseInt(value);
120+
return intValue % 2 === 0 && intValue >= 256 && intValue <= 8192;
121+
}),
120122
similarity: Matcher.anyOf(Matcher.undefined, Matcher.string()),
121123
},
122124
],
@@ -143,7 +145,7 @@ describeAccuracyTests(
143145
{
144146
type: "vector",
145147
path: "plotSummary",
146-
numDimensions: 1024,
148+
numDimensions: "1024",
147149
},
148150
{
149151
type: "filter",

tests/accuracy/sdk/matcher.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export abstract class Matcher {
3232
return new BooleanMatcher(expected);
3333
}
3434

35-
public static string(): Matcher {
36-
return new StringMatcher();
35+
public static string(additionalFilter: (value: string) => boolean = () => true): Matcher {
36+
return new StringMatcher(additionalFilter);
3737
}
3838

3939
public static caseInsensitiveString(text: string): Matcher {
@@ -153,8 +153,11 @@ class BooleanMatcher extends Matcher {
153153
}
154154

155155
class StringMatcher extends Matcher {
156+
constructor(private additionalFilter: (value: string) => boolean = () => true) {
157+
super();
158+
}
156159
public match(actual: unknown): number {
157-
return typeof actual === "string" ? 1 : 0;
160+
return typeof actual === "string" && this.additionalFilter(actual) ? 1 : 0;
158161
}
159162
}
160163

tests/integration/tools/mongodb/create/createIndex.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ describeWithMongoDB(
948948
{
949949
getUserConfig: () => ({
950950
...defaultTestConfig,
951-
previewFeatures: ["vectorSearch"],
951+
previewFeatures: ["search"],
952952
}),
953953
downloadOptions: {
954954
search: true,

0 commit comments

Comments
 (0)