2021-03-02 14:38:30 +00:00
|
|
|
var path = require('path')
|
2017-08-24 09:15:06 +00:00
|
|
|
require('should')
|
|
|
|
var tk = require('timekeeper')
|
2015-10-31 14:27:16 +00:00
|
|
|
|
2017-08-24 09:15:06 +00:00
|
|
|
var Logs = require('../../lib/logs.js')
|
2015-10-31 14:27:16 +00:00
|
|
|
var logs = new Logs({
|
|
|
|
path: '/tmp/',
|
|
|
|
type: 'linux'
|
2017-08-24 09:15:06 +00:00
|
|
|
})
|
2015-10-31 14:27:16 +00:00
|
|
|
|
2017-08-24 09:15:06 +00:00
|
|
|
describe('Logs', function () {
|
|
|
|
beforeEach(function () {
|
|
|
|
tk.freeze(1445455712000) // 2015-10-21 19:28:32
|
|
|
|
})
|
2015-10-31 14:27:16 +00:00
|
|
|
|
2017-08-24 09:15:06 +00:00
|
|
|
afterEach(function () {
|
|
|
|
tk.reset()
|
|
|
|
})
|
2015-10-31 14:27:16 +00:00
|
|
|
|
2017-08-24 09:15:06 +00:00
|
|
|
describe('generateLogFileName()', function () {
|
|
|
|
it('should generate valid file name', function () {
|
2021-07-10 12:04:14 +00:00
|
|
|
Logs.generateLogFileName('prefix', 'suffix').should.eql('prefix_2015-10-21_19-28-32_suffix.rpt')
|
2017-08-24 09:15:06 +00:00
|
|
|
})
|
|
|
|
})
|
2015-10-31 14:27:16 +00:00
|
|
|
|
2017-08-24 09:15:06 +00:00
|
|
|
describe('generateLogFilePath()', function () {
|
|
|
|
it('should generate valid file path', function () {
|
2021-07-10 12:04:14 +00:00
|
|
|
logs.generateLogFilePath('prefix', 'suffix').should.eql(path.join('/tmp', 'logs', 'prefix_2015-10-21_19-28-32_suffix.rpt'))
|
2017-08-24 09:15:06 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|