Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(() => Promise.all([
fs.mkdirs(themeDir),
fs.writeFile(hexo.config_path, 'theme: test')
]).then(() => hexo.init()));
before(() => fs.mkdirs(hexo.base_dir).then(() => hexo.init()));
before(() => fs.mkdirs(baseDir).then(() => hexo.init()));
beforeEach(() => {
hexo = new Hexo(pathFn.join(__dirname, 'generate_test'), {silent: true});
generate = generateConsole.bind(hexo);
return fs.mkdirs(hexo.base_dir).then(() => hexo.init());
});
before(() => {
clock = sinon.useFakeTimers(now);
return fs.mkdirs(hexo.base_dir).then(() => hexo.init()).then(() => hexo.scaffold.set('post', [
'title: {{ title }}',
'date: {{ date }}',
'tags:',
'---'
].join('\n'))).then(() => hexo.scaffold.set('draft', [
'title: {{ title }}',
'tags:',
'---'
].join('\n')));
});
before(() => {
hexo.config.new_post_name = NEW_POST_NAME;
return fs.mkdirs(hexo.base_dir).then(() => hexo.init());
});
before(function() {
return fs.mkdirs(hexo.base_dir).then(function() {
return hexo.init();
});
});
it('process() - delete', () => {
const box = newBox('test');
const cacheId = 'test/a.txt';
const processor = sinon.spy(file => {
file.type.should.eql('delete');
});
box.addProcessor(processor);
return Promise.all([
fs.mkdirs(box.base),
box.Cache.insert({
_id: cacheId
})
]).then(() => box.process()).then(() => {
processor.calledOnce.should.be.true;
}).finally(() => fs.rmdir(box.base));
});
before(() => fs.mkdirs(hexo.base_dir).then(() => hexo.init()));
before(() => fs.mkdirs(baseDir).then(() => hexo.init()));