'use strict';

describe('Meta Generator', () => {
  const Hexo = require('../../../lib/hexo');
  const hexo = new Hexo();
  const metaGenerator = require('../../../lib/plugins/filter/meta_generator').bind(hexo);
  const cheerio = require('cheerio');

  it('default', () => {
    const content = '<head><link></head>';
    const result = metaGenerator(content);

    const $ = cheerio.load(result);
    $('meta[name="generator"]').length.should.eql(1);
  });

  it('empty <head>', () => {
    const content = '<head></head>';
    const result = metaGenerator(content);

    // meta generator should not be prepended if <head> tag is empty
    // see https://github.com/hexojs/hexo/pull/3315
    const resultType = typeof result;
    resultType.should.eql('undefined');
  });
});

@@ -766,13 +766,264 @@
 );%0A  %7D);
+%0A%0A  it('disable meta_generator', () =%3E %7B%0A    const content = '%3Chead%3E%3Clink%3E%3C/head%3E';%0A    hexo.config.meta_generator = false;%0A    const result = metaGenerator(content);%0A%0A    const resultType = typeof result;%0A    resultType.should.eql('undefined');%0A  %7D);
 %0A%7D);%0A

add test for meta_generator option