@@ -47,16 +47,23 @@ describe("Index", function() {
4747 newFile2 : "and this will have more content"
4848 } ;
4949 var fileNames = Object . keys ( fileContent ) ;
50+ var addCallbacksCount = 0 ;
5051
5152 return Promise . all ( fileNames . map ( function ( fileName ) {
5253 return writeFile (
5354 path . join ( repo . workdir ( ) , fileName ) ,
5455 fileContent [ fileName ] ) ;
5556 } ) )
5657 . then ( function ( ) {
57- return index . addAll ( ) ;
58+ return index . addAll ( undefined , undefined , function ( ) {
59+ addCallbacksCount ++ ;
60+
61+ return 0 ; // confirm add
62+ } ) ;
5863 } )
5964 . then ( function ( ) {
65+ assert . equal ( addCallbacksCount , 2 ) ;
66+
6067 var newFiles = index . entries ( ) . filter ( function ( entry ) {
6168 return ~ fileNames . indexOf ( entry . path ) ;
6269 } ) ;
@@ -82,6 +89,7 @@ describe("Index", function() {
8289 differentFileName : "this has a different name and shouldn't be deleted"
8390 } ;
8491 var fileNames = Object . keys ( fileContent ) ;
92+ var removeCallbacksCount = 0 ;
8593
8694 return Promise . all ( fileNames . map ( function ( fileName ) {
8795 return writeFile (
@@ -98,9 +106,15 @@ describe("Index", function() {
98106
99107 assert . equal ( newFiles . length , 3 ) ;
100108
101- return index . removeAll ( "newFile*" ) ;
109+ return index . removeAll ( "newFile*" , function ( ) {
110+ removeCallbacksCount ++ ;
111+
112+ return 0 ; // confirm remove
113+ } ) ;
102114 } )
103115 . then ( function ( ) {
116+ assert . equal ( removeCallbacksCount , 2 ) ;
117+
104118 var newFiles = index . entries ( ) . filter ( function ( entry ) {
105119 return ~ fileNames . indexOf ( entry . path ) ;
106120 } ) ;
@@ -125,6 +139,7 @@ describe("Index", function() {
125139 newFile2 : "and this will have more content"
126140 } ;
127141 var fileNames = Object . keys ( fileContent ) ;
142+ var updateCallbacksCount = 0 ;
128143
129144 return Promise . all ( fileNames . map ( function ( fileName ) {
130145 return writeFile (
@@ -144,9 +159,15 @@ describe("Index", function() {
144159 return fse . remove ( path . join ( repo . workdir ( ) , fileNames [ 0 ] ) ) ;
145160 } )
146161 . then ( function ( ) {
147- return index . updateAll ( "newFile*" ) ;
162+ return index . updateAll ( "newFile*" , function ( ) {
163+ updateCallbacksCount ++ ;
164+
165+ return 0 ; // confirm update
166+ } ) ;
148167 } )
149168 . then ( function ( ) {
169+ assert . equal ( updateCallbacksCount , 1 ) ;
170+
150171 var newFiles = index . entries ( ) . filter ( function ( entry ) {
151172 return ~ fileNames . indexOf ( entry . path ) ;
152173 } ) ;
0 commit comments