-
Notifications
You must be signed in to change notification settings - Fork 59
/
test.js
49 lines (43 loc) · 1.25 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const path = require('path');
const yeomanAssert = require('yeoman-assert');
const helpers = require('yeoman-test');
const awesomeLint = require('awesome-lint');
const test = require('ava');
test.before(async () => {
await helpers
.run(path.join(__dirname, 'app'))
.withPrompts({
title: 'Awesome Awesomeness',
description: 'A curated list of awesomeness',
username: 'Awesomov Awesomovic',
email: 'awe@so.me'
});
});
test('creates all files', t => {
yeomanAssert.file([
'.gitattributes',
'code-of-conduct.md',
'contributing.md',
'readme.md'
]);
t.pass();
});
test('code of conduct contains email', t => {
yeomanAssert.fileContent('code-of-conduct.md', 'awe@so.me');
t.pass();
});
test('readme contains title', t => {
yeomanAssert.fileContent('readme.md', 'Awesome Awesomeness');
t.pass();
});
test('readme contains description', t => {
yeomanAssert.fileContent('readme.md', 'A curated list of awesomeness');
t.pass();
});
test('complies to awesome-lint', async t => {
const vfiles = await awesomeLint();
const messages = vfiles
.flatMap(vfile => vfile.messages)
.filter(message => message.ruleId !== 'awesome-git-repo-age' && message.ruleId !== 'awesome-github' && message.ruleId !== 'double-link');
t.is(messages.length, 0);
});