-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
68 lines (60 loc) · 1.38 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
'use strict';
import path from 'path';
import test from 'ava';
import helpers from 'yeoman-test';
import assert from 'yeoman-assert';
test.serial('Test standard scaffold', async () => {
await helpers
.run(path.join(__dirname, '/app'))
.withPrompts({
botName: 'my-awesome-bot',
githubUsername: 'tester',
website: 'helloworld',
webhookUrl: 'testing.ngrok.io',
token: 'token1234',
port: 5000,
heroku: true
});
// Core Code Intact
assert.file([
'app.js',
'test.js',
'.env',
'.gitignore',
'app.json', // Heroku True
'config.js',
'commands/example.js'
]);
// Tpl Assertions
assert.fileContent([
['readme.md', /https:\/\/img.shields.io\/travis\/tester\/my-awesome-bot.svg/],
['.env', /token1234/],
['.env', /testing.ngrok.io/],
['.env', /5000/]
]);
assert.noFileContent([
['readme.md', /<%.*%>/],
['.env', /<%.*%>/]
]);
});
test.serial('Test command sub-generator', async () => {
await helpers
.run(path.join(__dirname, '/command'))
.withPrompts({
commandName: 'test-command',
triggerPhrase: 'test-phrase'
});
// Core Code Intact
assert.file([
'commands/test-command.js'
]);
// Tpl Assertions
assert.fileContent([
['commands/test-command.js', /test-command/],
['commands/test-command.js', /test-phrase/]
]);
// Check to make sure no lingering tpls
assert.noFileContent([
['commands/test-command.js', /<%.*%>/]
]);
});