const path = require('path');
const nodeAssert = require('assert');
const yeomanAssert = require('yeoman-assert');
const helpers = require('yeoman-test');
const awesomeLint = require('awesome-lint');
const Lab = require('lab');

const lab = Lab.script();
exports.lab = lab;

lab.before(() => {
	return new Promise(resolve => {
		helpers.run(path.join(__dirname, '../app'))
			.withPrompts({
				title: 'Awesome Awesomeness',
				description: 'A curated list of awesomeness',
				username: 'Awesomov Awesomovic',
				email: 'awe@so.me'
			})
			.on('end', resolve);
	});
});

lab.test('all files are created', () => {
	return new Promise(resolve => {
		yeomanAssert.file([
			'.gitattributes',
			'code-of-conduct.md',
			'contributing.md',
			'readme.md'
		]);
		resolve();
	});
});

lab.experiment('code-of-conduct.md', () => {
	lab.test('contains email', () => {
		return new Promise(resolve => {
			yeomanAssert.fileContent('code-of-conduct.md', 'awe@so.me');
			resolve();
		});
	});
});

lab.experiment('readme.md', () => {
	lab.test('contains title', () => {
		return new Promise(resolve => {
			yeomanAssert.fileContent('readme.md', 'Awesome Awesomeness');
			resolve();
		});
	});

	lab.test('contains description', () => {
		return new Promise(resolve => {
			yeomanAssert.fileContent('readme.md', 'A curated list of awesomeness');
			resolve();
		});
	});

	lab.test('contains username', () => {
		return new Promise(resolve => {
			yeomanAssert.fileContent('readme.md', 'Awesomov Awesomovic');
			resolve();
		});
	});
});

lab.test('lint', () => {
	return awesomeLint().then(vfile => {
		nodeAssert.strictEqual(vfile.messages.length, 0);
	});
});

@@ -329,16 +329,20 @@
 %09helpers
+%0A%09%09%09
 .run(pat
@@ -1595,16 +1595,104 @@
 le =%3E %7B%0A
+%09%09const messages = vfile.messages.filter(msg =%3E msg.ruleId !== 'awesome/git-repo-age');%0A
 %09%09nodeAs
@@ -1708,22 +1708,16 @@
 ctEqual(
-vfile.
 messages

Disable awesome-lint rule git-repo-age