Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function lsStream (cache) {
const indexDir = bucketDir(cache)
const stream = from.obj()
// "/cachename/*"
readdirOrEmpty(indexDir)
.then((buckets) => {
return Promise.all(
buckets.map((bucket) => {
const bucketPath = path.join(indexDir, bucket)
// "/cachename//*"
return readdirOrEmpty(bucketPath).then((subbuckets) => {
return Promise.all(
subbuckets.map((subbucket) => {
const subbucketPath = path.join(bucketPath, subbucket)
// "/cachename///*"
return readdirOrEmpty(subbucketPath).then((entries) => {
it('should error if contents is a stream', function(done) {
pipe([
from.obj([file]),
task(),
concat(),
], (err) => {
expect(err).toBeInstanceOf(PluginError);
done();
});
});
});
it('should compile a pug template with a custom pug instance with filters', function(done) {
function assert(files) {
expect(files.length).toEqual(1);
const newFile = files[0];
expect(newFile).toMatchObject({
contents: Buffer.from('HELLO, TESTER!!!!'),
});
}
pipe([
from.obj([getFixture('filters.pug')]),
task(options),
concat(assert),
], done);
});
});
it('should compile a pug template with an extends', function(done) {
function assert(files) {
expect(files.length).toEqual(1);
const newFile = files[0];
expect(newFile).toMatchObject({
contents: Buffer.from('<div><h1>Hello World</h1></div>'),
});
}
pipe([
from.obj([getFixture('extends.pug')]),
task(),
concat(assert),
], done);
});
});
it('should emit errors of pug correctly', function(done) {
pipe([
from.obj([getFixture('pug-error.pug')]),
task(),
concat(),
], (err) => {
expect(err).toBeInstanceOf(PluginError);
done();
});
});
});