added unit testing, and started implementing unit tests...phew

This commit is contained in:
Josh Burman
2019-03-12 22:28:02 -04:00
parent 74aad4a957
commit e8c2539f1b
3489 changed files with 464813 additions and 88 deletions

48
node_modules/winston/test/transports/stream.test.js generated vendored Normal file
View File

@ -0,0 +1,48 @@
'use strict';
const path = require('path');
const writeable = require('../helpers').writeable;
const { MESSAGE } = require('triple-beam');
const os = require('os');
const winston = require('../../');
const split = require('split2');
const assume = require('assume');
describe('Stream({ stream })', function () {
it('should support objectMode streams', function (done) {
const expected = {
level: 'info',
message: 'lolwut testing!'
};
const stream = writeable(function (info) {
assume(info).equals(expected);
done();
});
const transport = new winston.transports.Stream({ stream });
transport.log(expected);
});
it('should support UTF8 encoding streams', function (done) {
const expected = {
level: 'info',
message: 'lolwut testing!',
[MESSAGE]: 'info: lolwut testing!'
};
const stream = writeable(function (raw) {
assume(raw.toString()).equals(`${expected[MESSAGE]}${os.EOL}`);
done();
}, false);
const transport = new winston.transports.Stream({ stream });
transport.log(expected);
});
it('should throw when not passed a stream', function () {
assume(function () {
const stream = new winston.transports.Stream()
}).throws('options.stream is required.');''
});
});