@@ -61,7 +61,10 @@ vows.describe('log4js').addBatch({
61
61
assert . isNull ( arguments [ 2 ] ) ;
62
62
assert . equal ( arguments [ 3 ] , "utf8" ) ;
63
63
logmessages . push ( arguments [ 1 ] ) ;
64
- }
64
+ } ,
65
+ watchFile : function ( ) {
66
+ throw new Error ( "watchFile should not be called if logSize is not defined" ) ;
67
+ }
65
68
} ,
66
69
log4js = require ( '../lib/log4js' ) ( fakeFS ) ;
67
70
log4js . clearAppenders ( ) ;
@@ -91,7 +94,8 @@ vows.describe('log4js').addBatch({
91
94
log4js = require ( '../lib/log4js' ) ( {
92
95
watchFile : function ( file , options , callback ) {
93
96
assert . equal ( file , 'tests.log' ) ;
94
- assert . deepEqual ( options , { persistent : true , interval : 30000 } ) ;
97
+ assert . equal ( options . persistent , false ) ;
98
+ assert . equal ( options . interval , 30000 ) ;
95
99
assert . isFunction ( callback ) ;
96
100
watchCb = callback ;
97
101
} ,
@@ -146,10 +150,10 @@ vows.describe('log4js').addBatch({
146
150
assert . length ( filesClosed , 2 ) ;
147
151
//it should have renamed both the old log file, and the previous '.1' file
148
152
assert . length ( filesRenamed , 3 ) ;
149
- assert . deepEqual ( filesRenamed , [ 'tests.log' , 'tests.log' , 'tests.log.1 ' ] ) ;
153
+ assert . deepEqual ( filesRenamed , [ 'tests.log' , 'tests.log.1 ' , 'tests.log' ] ) ;
150
154
//it should have renamed 2 more file
151
- assert . length ( existingFiles , 2 ) ;
152
- assert . deepEqual ( existingFiles , [ 'tests.log' , 'tests.log.2' , 'tests.log.1' ] ) ;
155
+ assert . length ( existingFiles , 4 ) ;
156
+ assert . deepEqual ( existingFiles , [ 'tests.log' , 'tests.log.1' , 'tests.log. 2', 'tests.log.1' ] ) ;
153
157
//and opened a new log file
154
158
assert . length ( filesOpened , 3 ) ;
155
159
@@ -159,10 +163,10 @@ vows.describe('log4js').addBatch({
159
163
assert . length ( filesClosed , 3 ) ;
160
164
//it should have renamed the old log file and the 2 backups, with the last one being overwritten.
161
165
assert . length ( filesRenamed , 5 ) ;
162
- assert . deepEqual ( filesRenamed , [ 'tests.log' , 'tests.log' , 'tests.log.1 ' , 'tests.log' , 'tests.log.1 ' ] ) ;
166
+ assert . deepEqual ( filesRenamed , [ 'tests.log' , 'tests.log.1 ' , 'tests.log' , 'tests.log.1 ' , 'tests.log' ] ) ;
163
167
//it should have renamed 2 more files
164
- assert . length ( existingFiles , 5 ) ;
165
- assert . deepEqual ( existingFiles , [ 'tests.log' , 'tests.log.2' , 'tests.log.1' , 'tests.log.2' , 'tests.log.1' ] ) ;
168
+ assert . length ( existingFiles , 6 ) ;
169
+ assert . deepEqual ( existingFiles , [ 'tests.log' , 'tests.log.1' , 'tests.log. 2', 'tests.log.1' , 'tests.log.2' , 'tests.log.1' ] ) ;
166
170
//and opened a new log file
167
171
assert . length ( filesOpened , 4 ) ;
168
172
}
0 commit comments