@@ -203,16 +203,27 @@ describe('#7467 a spec-valid stored form carrying a publicPicker reaches the loo
203203 // the declared object override, the declared cap, the declared filter
204204 // rows ahead of the visitor's search predicate, id + displayFields
205205 // projection, offset pinned to 0 (no anonymous pagination).
206+ //
207+ // [#16337] The KEYS are the canonical QueryAST ones (`where` / `fields`
208+ // / `orderBy`); until then the route spelled them `filters` / `select` /
209+ // `sort`, wire aliases the normalizer folds onto exactly these. The
210+ // VALUES are byte-identical across that rewrite, which is the point —
211+ // and note what `where` carries: `ViewFilterRule` rows, the dialect
212+ // `FormFieldPublicPickerSchema.filter` declares, NOT a
213+ // `FilterCondition`. `findData` is stubbed in this suite, so it never
214+ // meets the ingress's verdict on that value; the real normalizer
215+ // refuses it. Filed separately — ⛔ do not "repair" it by editing this
216+ // expectation.
206217 expect ( findData ) . toHaveBeenCalledTimes ( 1 ) ;
207218 const call = findData . mock . calls [ 0 ] [ 0 ] ;
208219 expect ( call . object ) . toBe ( 'sys_user' ) ;
209220 expect ( call . query . limit ) . toBe ( 10 ) ;
210221 expect ( call . query . offset ) . toBe ( 0 ) ;
211- expect ( call . query . select ) . toEqual ( [ 'id' , 'name' , 'email' ] ) ;
222+ expect ( call . query . fields ) . toEqual ( [ 'id' , 'name' , 'email' ] ) ;
212223 // [#7485] Ordering is fixed, not authorable: first display field,
213224 // ascending. The route's `picker.sort ??` read is retired.
214- expect ( call . query . sort ) . toEqual ( [ { field : 'name' , order : 'asc' } ] ) ;
215- expect ( call . query . filters ) . toEqual ( [
225+ expect ( call . query . orderBy ) . toEqual ( [ { field : 'name' , order : 'asc' } ] ) ;
226+ expect ( call . query . where ) . toEqual ( [
216227 { field : 'is_active' , operator : 'equals' , value : true } ,
217228 { field : 'name' , operator : 'contains' , value : 'ad' } ,
218229 ] ) ;
@@ -299,7 +310,7 @@ describe('#7485 publicPicker.sort is retired — not declarable, and not read',
299310 // The stored `{ field: 'email', order: 'desc' }` reaches `findData`
300311 // nowhere: the fixed default is the only ordering the route composes.
301312 expect ( findData ) . toHaveBeenCalledTimes ( 1 ) ;
302- expect ( findData . mock . calls [ 0 ] [ 0 ] . query . sort ) . toEqual ( [ { field : 'name' , order : 'asc' } ] ) ;
313+ expect ( findData . mock . calls [ 0 ] [ 0 ] . query . orderBy ) . toEqual ( [ { field : 'name' , order : 'asc' } ] ) ;
303314 } ) ;
304315
305316 it ( '…and the fixed sort tracks displayFields[0], including the no-displayFields default' , async ( ) => {
@@ -310,15 +321,15 @@ describe('#7485 publicPicker.sort is retired — not declarable, and not read',
310321 const stored = await persistedBody ( studioForm ( [ { field : 'owner' , publicPicker : { object : 'sys_user' } } ] ) ) ;
311322 const { findData, lookup } = routesOver ( stored , [ ] ) ;
312323 await lookup . handler ( { params : { slug : 'contact' , field : 'owner' } , query : { } } as any , mockRes ( ) ) ;
313- expect ( findData . mock . calls [ 0 ] [ 0 ] . query . sort ) . toEqual ( [ { field : 'name' , order : 'asc' } ] ) ;
324+ expect ( findData . mock . calls [ 0 ] [ 0 ] . query . orderBy ) . toEqual ( [ { field : 'name' , order : 'asc' } ] ) ;
314325
315326 const stored2 = await persistedBody ( studioForm ( [ {
316327 field : 'owner' ,
317328 publicPicker : { displayFields : [ 'email' , 'name' ] , object : 'sys_user' } ,
318329 } ] ) ) ;
319330 const second = routesOver ( stored2 , [ ] ) ;
320331 await second . lookup . handler ( { params : { slug : 'contact' , field : 'owner' } , query : { } } as any , mockRes ( ) ) ;
321- expect ( second . findData . mock . calls [ 0 ] [ 0 ] . query . sort ) . toEqual ( [ { field : 'email' , order : 'asc' } ] ) ;
332+ expect ( second . findData . mock . calls [ 0 ] [ 0 ] . query . orderBy ) . toEqual ( [ { field : 'email' , order : 'asc' } ] ) ;
322333 } ) ;
323334} ) ;
324335
0 commit comments