diff --git a/test/scripts/filters/meta_generator.js b/test/scripts/filters/meta_generator.js index 89338b773d..03814a4e63 100644 --- a/test/scripts/filters/meta_generator.js +++ b/test/scripts/filters/meta_generator.js @@ -7,7 +7,7 @@ describe('Meta Generator', () => { const cheerio = require('cheerio'); it('default', () => { - const content = 'foo'; + const content = ''; const result = metaGenerator(content); const $ = cheerio.load(result); @@ -16,7 +16,7 @@ describe('Meta Generator', () => { }); it('disable meta_generator', () => { - const content = 'foo'; + const content = ''; hexo.config.meta_generator = false; const result = metaGenerator(content); @@ -25,7 +25,7 @@ describe('Meta Generator', () => { }); it('no duplicate generator tag', () => { - const content = 'foo' + const content = '' + ''; hexo.config.meta_generator = true; const result = metaGenerator(content); @@ -36,7 +36,6 @@ describe('Meta Generator', () => { it('ignore empty head tag', () => { const content = '' - + '' + '' + ''; hexo.config.meta_generator = true; @@ -47,8 +46,23 @@ describe('Meta Generator', () => { const expected = '' + '' - + '' + ''; result.should.eql(expected); }); + + it('apply to first non-empty head tag only', () => { + const content = '' + + '' + + ''; + hexo.config.meta_generator = true; + const result = metaGenerator(content); + + const $ = cheerio.load(result); + $('meta[name="generator"]').length.should.eql(1); + + const expected = '' + + '' + + ''; + result.should.eql(expected); + }); });