-
Notifications
You must be signed in to change notification settings - Fork 13
/
test.js
37 lines (30 loc) · 1.02 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
import test from 'ava';
import execa from 'execa';
test('Test output without arguments', async t => {
const ret = await execa.shell('node cli.js');
t.regex(ret.stdout, /Usage/);
});
test('Test --help', async t => {
const ret = await execa.shell('node cli.js --help');
t.regex(ret.stdout, /Options/);
});
test('Test --today', async t => {
const ret = await execa.shell('node cli.js --today');
t.regex(ret.stdout, /Done/);
});
test('Test --date (picture)', async t => {
const ret = await execa.shell('node cli.js --date 171224');
t.regex(ret.stdout, /Done/);
});
test('Test --date (video)', async t => {
const ret = await execa.shell('node cli.js --date 171220');
t.regex(ret.stdout, /Today is a video/);
});
test('Test --date without date', async t => {
const ret = await execa.shell('node cli.js --date');
t.regex(ret.stdout, /Please provide a valid date!/);
});
test('Test error message', async t => {
const error = await t.throws(execa.shell('node cli.js --date foo'));
t.regex(error.message, /Something went wrong/);
});