Skip to content

Commit

Permalink
fix(meta_generator): parse correct version (hexojs#3925)
Browse files Browse the repository at this point in the history
* fix(meta_generator): parse correct version
* refactor(meta_generator_helper): destructure
  • Loading branch information
curbengh authored and Thomas Parisot committed Jan 17, 2020
1 parent fb9cf04 commit 4787961
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/helper/meta_generator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

function metaGeneratorHelper() {
return `<meta name="generator" content="Hexo ${this.version}">`;
return `<meta name="generator" content="Hexo ${this.env.version}">`;
}

module.exports = metaGeneratorHelper;
6 changes: 5 additions & 1 deletion test/scripts/helpers/meta_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ describe('meta_generator', () => {
const metaGeneratorHelper = require('../../../lib/plugins/helper/meta_generator').bind(hexo);

it('default', () => {
metaGeneratorHelper().should.eql(`<meta name="generator" content="Hexo ${hexo.version}">`);
const { version } = hexo;
const versionType = typeof version;

versionType.should.not.eql('undefined');
metaGeneratorHelper().should.eql(`<meta name="generator" content="Hexo ${version}">`);
});
});

0 comments on commit 4787961

Please sign in to comment.