2015-03-11 12:14:35 -04:00

52 lines
1.5 KiB
JavaScript

'use strict';
var test = require('tape'),
documentation = require('../'),
path = require('path'),
concat = require('concat-stream'),
chdir = require('chdir');
test('documentation', function (t) {
documentation(path.join(__dirname, 'fixture/simple.js')).pipe(concat(function (data) {
t.equal(data.length, 1, 'simple has no dependencies');
t.end();
}));
});
test('documentation - single star', function (t) {
documentation(path.join(__dirname, 'fixture/simple-singlestar.js')).pipe(concat(function (data) {
t.equal(data.length, 0, 'simple has no dependencies');
t.end();
}));
});
test('documentation - triple star', function (t) {
documentation(path.join(__dirname, 'fixture/simple-triplestar.js')).pipe(concat(function (data) {
t.equal(data.length, 0, 'simple has no dependencies');
t.end();
}));
});
test('documentation - hashbang', function (t) {
documentation(path.join(__dirname, 'fixture/simple-hashbang.js')).pipe(concat(function (data) {
t.equal(data.length, 1, 'simple has no dependencies');
t.end();
}));
});
test('skips external dependencies', function (t) {
documentation(path.join(__dirname, 'fixture/external.js')).pipe(concat(function (data) {
t.equal(data.length, 0);
t.end();
}));
});
test('accepts simple relative paths', function (t) {
chdir(__dirname, function () {
documentation('fixture/simple.js').pipe(concat(function (data) {
t.equal(data.length, 1, 'simple has no dependencies');
t.end();
}));
});
});