-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocation.js
More file actions
65 lines (52 loc) · 1.79 KB
/
Copy pathlocation.js
File metadata and controls
65 lines (52 loc) · 1.79 KB
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
'use strict';
var should = require('should');
var batch = require('../.');
var name = require('../package').name;
module.exports = function(){
it('should return given batch', function (done){
var input = 'hello world what up';
batch.these(input, function(batch){
should(batch.join('')).match(input);
done();
});
});
it('should be able to handle different batches', function (done){
var data = ['hello world', 'what up'];
batch.these(data[0], function firstBatch(chunks){
should(this.module).eql(name);
should(this.handle.name).eql('firstBatch');
should(chunks.join('')).match(data[0]);
});
batch.these(data[1], function secondBatch(chunks){
should(this.module).eql(name);
should(this.handle.name).eql('secondBatch');
should(chunks.join('')).match(data[1]);
done();
});
});
it('different batches should have their handle', function (done){
var data = ['hello world', 'what up'];
batch.these(data[0], function firstBatch(){
should(this.handle.name).eql('firstBatch');
});
batch.these(data[1], function secondBatch(){
should(this.handle.name).eql('secondBatch');
done();
});
});
it('different batches should be run on sequence', function (done){
var data = ['hello world', 'what up'];
var previousLocation;
batch.these(data[0], function firstBatch(chunks){
previousLocation = this.location;
should(this.location).eql([__filename,51,11].join(':'));
should(chunks.join('')).match(data[0]);
});
batch.these(data[1], function secondBatch(chunks){
should(previousLocation).eql([__filename,51,11].join(':'));
should(this.location).eql([__filename,57,11].join(':'));
should(chunks.join('')).match(data[1]);
done();
});
});
};