File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,9 +39,13 @@ const getOperations = (event, deps) => {
3939
4040 toggleSelectedFile,
4141 Buffer = { } ,
42+ createFindNext = _createFindNext ,
4243 } = deps ;
4344
4445 return {
46+ findNext : createFindNext ( {
47+ setCurrentByName,
48+ } ) ,
4549 escape : unselectFiles ,
4650
4751 remove : ( ) => {
@@ -119,11 +123,6 @@ const getOperations = (event, deps) => {
119123 setCurrentByName ( result ) ;
120124 } ,
121125
122- findNext : ( ) => {
123- const name = finder . findNext ( ) ;
124- setCurrentByName ( name ) ;
125- } ,
126-
127126 findPrevious : ( ) => {
128127 const name = finder . findPrevious ( ) ;
129128 setCurrentByName ( name ) ;
@@ -132,3 +131,10 @@ const getOperations = (event, deps) => {
132131} ;
133132
134133module . exports . selectFile = selectFileNotParent ;
134+
135+ const _createFindNext = ( overrides = { } ) => ( ) => {
136+ const { setCurrentByName} = overrides ;
137+ const name = finder . findNext ( ) ;
138+
139+ setCurrentByName ( name ) ;
140+ } ;
Original file line number Diff line number Diff line change @@ -570,17 +570,13 @@ test('cloudcmd: client: find', (t) => {
570570
571571test ( 'cloudcmd: client: key: n' , ( t ) => {
572572 const findNext = stub ( ) ;
573+ const createFindNext = stub ( ) . returns ( findNext ) ;
573574
574- mockRequire ( pathFind , {
575- findNext,
576- } ) ;
577-
578- const vim = reRequire ( pathVim ) ;
579575 const event = { } ;
580576
581- vim ( 'n' , event ) ;
582-
583- stopAll ( ) ;
577+ vim ( 'n' , event , {
578+ createFindNext ,
579+ } ) ;
584580
585581 t . calledWithNoArgs ( findNext , 'should call findNext' ) ;
586582 t . end ( ) ;
You can’t perform that action at this time.
0 commit comments