Tizen 2.1 base
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / node_modules / grunt / node_modules / prompt / node_modules / winston / test / transports / file-test.js
1 /*
2  * file-test.js: Tests for instances of the File transport
3  *
4  * (C) 2010 Charlie Robbins
5  * MIT LICENSE
6  *
7  */
8
9 var path = require('path'),
10     vows = require('vows'),
11     fs = require('fs'),
12     assert = require('assert'),
13     winston = require('../../lib/winston'),
14     helpers = require('../helpers');
15
16 var stream = fs.createWriteStream(path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log')),
17     fileTransport = new (winston.transports.File)({ filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfilename.log') }),
18     streamTransport = new (winston.transports.File)({ stream: stream });
19
20 vows.describe('winston/transports/file').addBatch({
21   "An instance of the File Transport": {
22     "when passed a valid filename": {
23       "should have the proper methods defined": function () {
24         helpers.assertFile(fileTransport);
25       },
26       "the log() method": helpers.testNpmLevels(fileTransport, "should respond with true", function (ign, err, logged) {
27         assert.isNull(err);
28         assert.isTrue(logged);
29       })
30     },
31     "when passed a valid file stream": {
32       "should have the proper methods defined": function () {
33         helpers.assertFile(streamTransport);
34       },
35       "the log() method": helpers.testNpmLevels(streamTransport, "should respond with true", function (ign, err, logged) {
36         assert.isNull(err);
37         assert.isTrue(logged);
38       })
39     }
40   }
41 }).addBatch({
42   "These tests have a non-deterministic end": {
43     topic: function () {
44       setTimeout(this.callback, 200);
45     },
46     "and this should be fixed before releasing": function () {
47       assert.isTrue(true);
48     }
49   }
50 }).export(module);