Skip to content

Commit

Permalink
test: improve coverage (hexojs#4050)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Jan 10, 2020
1 parent 810283a commit 9d0abef
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/scripts/console/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ describe('config', () => {
should.not.exist(config.language);
});

it('write config: undefined', async () => {
const config = await writeConfig('meta_generator', 'undefined');
should.not.exist(config.meta_generator);
});

it('write config: regex', async () => {
const config = await writeConfig('include', /^pattern$/gim);
config.include.should.eql(/^pattern$/gim);
Expand Down
6 changes: 6 additions & 0 deletions test/scripts/console/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ describe('deploy', () => {

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

it('no deploy config', () => {
delete hexo.config.deploy;

should.not.exist(deploy({test: true}));
});

it('single deploy setting', () => {
hexo.config.deploy = {
type: 'foo',
Expand Down
1 change: 1 addition & 0 deletions test/scripts/extend/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ describe('Filter', () => {

f.register('test', () => {});

f.list().test.should.exist;
f.list('test')[0].should.exist;
f.list('foo').length.should.eql(0);
});
Expand Down
13 changes: 13 additions & 0 deletions test/scripts/extend/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,17 @@ describe('Tag', () => {
result.should.eql('bar');
});
});

it('render() - callback', () => {
const tag = new Tag();

const callback = sinon.spy();

tag.register('test', () => 'foo');

return tag.render('{% test %}', callback()).then(result => {
result.should.eql('foo');
callback.calledOnce.should.be.true;
});
});
});

0 comments on commit 9d0abef

Please sign in to comment.