@@ -16,14 +16,8 @@ const opts = {
1616 maxCells : 8 ,
1717} ;
1818
19- const testSchema = schema as unknown as NonNullable <
20- Parameters < typeof convexTest > [ 0 ]
21- > ;
22- const testModules = modules as NonNullable < Parameters < typeof convexTest > [ 1 ] > ;
23- type ClosestQueryCtx = Parameters < ClosestPointQuery [ "execute" ] > [ 0 ] ;
24-
2519test ( "closest point query - basic functionality" , async ( ) => {
26- const t = await convexTest ( testSchema , testModules ) ;
20+ const t = convexTest ( schema , modules ) ;
2721 const s2 = await S2Bindings . load ( ) ;
2822 const logger = createLogger ( "INFO" ) ;
2923
@@ -58,7 +52,6 @@ test("closest point query - basic functionality", async () => {
5852 }
5953
6054 await t . run ( async ( ctx ) => {
61- const queryCtx = ctx as unknown as ClosestQueryCtx ;
6255 // Test finding closest point to origin
6356 const query1 = new ClosestPointQuery (
6457 s2 ,
@@ -70,7 +63,7 @@ test("closest point query - basic functionality", async () => {
7063 opts . maxLevel ,
7164 opts . levelMod ,
7265 ) ;
73- const result1 = await query1 . execute ( queryCtx ) ;
66+ const result1 = await query1 . execute ( ctx ) ;
7467 expect ( result1 . length ) . toBe ( 1 ) ;
7568 expect ( result1 [ 0 ] . key ) . toBe ( "point1" ) ;
7669 expect ( result1 [ 0 ] . distance ) . toBeLessThan ( 1 ) ; // Should be very close to 0
@@ -86,7 +79,7 @@ test("closest point query - basic functionality", async () => {
8679 opts . maxLevel ,
8780 opts . levelMod ,
8881 ) ;
89- const result2 = await query2 . execute ( queryCtx ) ;
82+ const result2 = await query2 . execute ( ctx ) ;
9083 expect ( result2 . length ) . toBe ( 2 ) ;
9184 expect ( result2 [ 0 ] . key ) . toBe ( "point2" ) ;
9285 expect ( result2 [ 1 ] . key ) . toBe ( "point1" ) ;
@@ -103,7 +96,7 @@ test("closest point query - basic functionality", async () => {
10396 opts . maxLevel ,
10497 opts . levelMod ,
10598 ) ;
106- const result3 = await query3 . execute ( queryCtx ) ;
99+ const result3 = await query3 . execute ( ctx ) ;
107100 expect ( result3 . length ) . toBe ( 1 ) ;
108101 expect ( result3 [ 0 ] . key ) . toBe ( "point1" ) ;
109102
@@ -125,7 +118,7 @@ test("closest point query - basic functionality", async () => {
125118 } ,
126119 ] ,
127120 ) ;
128- const result4 = await query4 . execute ( queryCtx ) ;
121+ const result4 = await query4 . execute ( ctx ) ;
129122 expect ( result4 . length ) . toBe ( 2 ) ;
130123 expect ( result4 . map ( ( r ) => r . key ) . sort ( ) ) . toEqual ( [ "point1" , "point3" ] ) ;
131124
@@ -147,7 +140,7 @@ test("closest point query - basic functionality", async () => {
147140 } ,
148141 ] ,
149142 ) ;
150- const result5 = await query5 . execute ( queryCtx ) ;
143+ const result5 = await query5 . execute ( ctx ) ;
151144 expect ( result5 . length ) . toBe ( 1 ) ;
152145 expect ( result5 [ 0 ] . key ) . toBe ( "point2" ) ;
153146
@@ -164,7 +157,7 @@ test("closest point query - basic functionality", async () => {
164157 [ ] ,
165158 { startInclusive : 3 } ,
166159 ) ;
167- const result6 = await query6 . execute ( queryCtx ) ;
160+ const result6 = await query6 . execute ( ctx ) ;
168161 expect ( result6 . length ) . toBe ( 1 ) ;
169162 expect ( result6 [ 0 ] . key ) . toBe ( "point3" ) ;
170163
@@ -191,7 +184,7 @@ test("closest point query - basic functionality", async () => {
191184 } ,
192185 ] ,
193186 ) ;
194- const result7 = await query7 . execute ( queryCtx ) ;
187+ const result7 = await query7 . execute ( ctx ) ;
195188 expect ( result7 . length ) . toBe ( 3 ) ;
196189 expect ( new Set ( result7 . map ( ( r ) => r . key ) ) ) . toEqual (
197190 new Set ( [ "point1" , "point2" , "point3" ] ) ,
@@ -202,7 +195,7 @@ test("closest point query - basic functionality", async () => {
202195fcTest . prop ( { documents : arbitraryDocuments } ) (
203196 "closest point query - property based testing" ,
204197 async ( { documents } ) => {
205- const t = await convexTest ( testSchema , testModules ) ;
198+ const t = convexTest ( schema , modules ) ;
206199 const s2 = await S2Bindings . load ( ) ;
207200 const logger = createLogger ( "INFO" ) ;
208201
@@ -215,7 +208,6 @@ fcTest.prop({ documents: arbitraryDocuments })(
215208 }
216209
217210 await t . run ( async ( ctx ) => {
218- const queryCtx = ctx as unknown as ClosestQueryCtx ;
219211 const testPoint = { latitude : 0 , longitude : 0 } ;
220212 const query = new ClosestPointQuery (
221213 s2 ,
@@ -227,7 +219,7 @@ fcTest.prop({ documents: arbitraryDocuments })(
227219 opts . maxLevel ,
228220 opts . levelMod ,
229221 ) ;
230- const results = await query . execute ( queryCtx ) ;
222+ const results = await query . execute ( ctx ) ;
231223
232224 // Verify results are ordered by distance
233225 for ( let i = 1 ; i < results . length ; i ++ ) {
0 commit comments