Merge pull request #1365 from log4js-node/update-test

test: improved test for fileAppender
This commit is contained in:
Lam Wei Li 2023-02-20 14:00:09 +08:00 committed by GitHub
commit 7ebc9e0238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -435,16 +435,18 @@ test('log4js fileAppender', (batch) => {
t.test('should log when writer.writable=true', (assert) => {
writable = true;
assert.ok(output.length === 0);
appender({ data: 'something to log' });
assert.ok(output.length, 1);
assert.ok(output.length === 1);
assert.match(output[output.length - 1], 'something to log');
assert.end();
});
t.test('should not log when writer.writable=false', (assert) => {
writable = false;
assert.ok(output.length === 1);
appender({ data: 'this should not be logged' });
assert.ok(output.length, 1);
assert.ok(output.length === 1);
assert.notMatch(output[output.length - 1], 'this should not be logged');
assert.end();
});