@@ -205,6 +205,30 @@ describe('Database Provider', () => {
205205 assert ( result [ 2 ] === null )
206206 } )
207207
208+ test ( 'Surround and using only method' , async ( ) => {
209+ const fetcher = createPipelineFetcher ( ( ) => Promise . resolve ( [ { id : 1 , _path : '/a' } , { id : 2 , _path : '/b' } , { id : 3 , _path : '/c' } ] as any [ ] ) )
210+ const result = await createQuery ( fetcher )
211+ . only ( [ '_path' ] )
212+ . findSurround ( { id : 3 } , { before : 2 , after : 1 } )
213+
214+ assert ( ( result as Array < any > ) . length === 3 )
215+ assert ( result [ 0 ] . _path === '/a' )
216+ assert ( result [ 1 ] . _path === '/b' )
217+ assert ( result [ 2 ] === null )
218+ } )
219+
220+ test ( 'Surround and using without method' , async ( ) => {
221+ const fetcher = createPipelineFetcher ( ( ) => Promise . resolve ( [ { id : 1 , _path : '/a' } , { id : 2 , _path : '/b' } , { id : 3 , _path : '/c' } ] as any [ ] ) )
222+ const result = await createQuery ( fetcher )
223+ . without ( 'id' )
224+ . findSurround ( { id : 3 } , { before : 2 , after : 1 } )
225+
226+ assert ( ( result as Array < any > ) . length === 3 )
227+ assert ( result [ 0 ] . _path === '/a' )
228+ assert ( result [ 1 ] . _path === '/b' )
229+ assert ( result [ 2 ] === null )
230+ } )
231+
208232 test ( 'Chain multiple where conditions' , async ( ) => {
209233 const fetcher = createPipelineFetcher ( ( ) => Promise . resolve ( [ { id : 1 , path : '/a' } , { id : 2 , path : '/b' } , { id : 3 , path : '/c' } ] as any [ ] ) )
210234 const query = createQuery ( fetcher ) . where ( { id : { $in : [ 1 , 2 ] } } )
0 commit comments