-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration-test.js
32 lines (30 loc) · 1.12 KB
/
integration-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
var test = require('tape');
var pull = require('pull-stream');
var getRetrievalStream = require('./lib/get-retrieval-stream');
var through = require('through');
var jsonStream = require('JSONStream');
test('getRetrievalStream gets array of repo names and functions', function(t) {
pull(
getRetrievalStream('brainpm-testcases', 'brainpm-testcases'),
pull.collect(function(err, receivedArray) {
t.error(err);
t.equal(receivedArray.length, 1);
var first = receivedArray[0];
t.equal(first.name, 'teach-nothing');
t.equal(typeof first.getFileStream, 'function');
t.end();
})
);
});
test('getFileStream("package.json") returns stream of file content', function(t) {
pull(
getRetrievalStream('brainpm-testcases', 'brainpm-testcases'),
pull.collect(function(err, receivedArray) {
t.error(err);
var first = receivedArray[0];
first.getFileStream("package.json").pipe(jsonStream.parse()).pipe(through(function(pkg) {
t.equal(pkg.name, 'teach-nothing');
t.end();
}));
}));
});