Skip to content

Commit

Permalink
refactor(test-generators-page): arrow function (hexojs#3956)
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Jan 10, 2020
1 parent 9d0abef commit e9ec221
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions test/scripts/generators/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ describe('page', () => {
const Page = hexo.model('Page');
const generator = Promise.method(require('../../../lib/plugins/generator/page').bind(hexo));

function locals() {
const locals = () => {
hexo.locals.invalidate();
return hexo.locals.toObject();
}
};

it('default layout', async () => {
const page = await Page.insert({
Expand Down
22 changes: 17 additions & 5 deletions test/scripts/hexo/load_database.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ describe('Load database', () => {
hexo._dbLoaded = false;
});

after(async () => {
const exist = await exists(dbPath);
if (exist) await unlink(dbPath);
rmdir(hexo.base_dir);
});
after(() => rmdir(hexo.base_dir));

it('database does not exist', () => loadDatabase(hexo));

Expand All @@ -57,6 +53,22 @@ describe('Load database', () => {

await unlink(dbPath);
});
});

// #3975 workaround for Windows
describe('Load database - load failed', () => {
const Hexo = require('../../../lib/hexo');
const hexo = new Hexo(join(__dirname, 'db_test'), {silent: true});
const loadDatabase = require('../../../lib/hexo/load_database');
const dbPath = hexo.database.options.path;

before(() => mkdirs(hexo.base_dir));

beforeEach(() => {
hexo._dbLoaded = false;
});

after(() => rmdir(hexo.base_dir));

it('database load failed', async () => {
await writeFile(dbPath, '{1423432: 324');
Expand Down

0 comments on commit e9ec221

Please sign in to comment.