-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
83 lines (64 loc) · 1.81 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
var fs = require('fs');
var assert = require('assert');
var gutil = require('gulp-util');
var todoist = require('./');
var streamFile = function (filename, stream) {
var testFile = fs.readFileSync(filename);
stream.write(new gutil.File({
path: filename,
contents: new Buffer(testFile.toString())
}));
stream.end();
};
describe('gulp-todoist streaming', function () {
it('should have nothing to report', function (cb) {
var stream = todoist({
silent: true
});
var expected = fs.readFileSync('./tests/fixtures/01-empty.js', 'utf8').trim();
stream.on('data', function (data) {
assert.deepEqual(data, {});
}).on('end', function (out) {
cb();
});
streamFile('./tests/fixtures/01-empty.js', stream);
});
it('should report fixme', function (cb) {
var stream = todoist({
silent: true
});
var expected = fs.readFileSync('./tests/fixtures/02-fixme.js', 'utf8').trim();
stream.on('data', function (data) {
assert.equal(data.FIXME, 1);
}).on('end', function (out) {
cb();
});
streamFile('./tests/fixtures/02-fixme.js', stream);
});
it('should report todo', function (cb) {
var stream = todoist({
silent: true
});
var expected = fs.readFileSync('./tests/fixtures/03-todo.js', 'utf8').trim();
stream.on('data', function (data) {
assert.equal(data.TODO, 1);
}).on('end', function (out) {
cb();
});
streamFile('./tests/fixtures/03-todo.js', stream);
});
it('should report fixme & todo', function (cb) {
var stream = todoist({
silent: true
});
var expected = fs.readFileSync('./tests/fixtures/04-multiple.js', 'utf8').trim();
stream.on('data', function (data) {
assert.equal(data.FIXME, 1);
assert.equal(data.TODO, 1);
}).on('end', function (out) {
cb();
});
streamFile('./tests/fixtures/04-multiple.js', stream);
});
});