-
Notifications
You must be signed in to change notification settings - Fork 935
/
Copy pathheader-full-stop.test.js
61 lines (51 loc) · 1.66 KB
/
header-full-stop.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
import test from 'ava';
import parse from '@commitlint/parse';
import check from './header-full-stop';
const messages = {
with: `header.\n`,
without: `header\n`
};
const parsed = {
with: parse(messages.with),
without: parse(messages.without)
};
test('with against "always ." should succeed', async t => {
const [actual] = check(await parsed.with, 'always', '.');
const expected = true;
t.is(actual, expected);
});
test('with against "never ." should fail', async t => {
const [actual] = check(await parsed.with, 'never', '.');
const expected = false;
t.is(actual, expected);
});
test('without against "always ." should fail', async t => {
const [actual] = check(await parsed.without, 'always', '.');
const expected = false;
t.is(actual, expected);
});
test('without against "never ." should succeed', async t => {
const [actual] = check(await parsed.without, 'never', '.');
const expected = true;
t.is(actual, expected);
});
test('with against "always [\\.0-9]" should succeed', async t => {
const [actual] = check(await parsed.with, 'always', '[\\.0-9]');
const expected = true;
t.is(actual, expected);
});
test('with against "never [\\.0-9]" should fail', async t => {
const [actual] = check(await parsed.with, 'never', '[\\.0-9]');
const expected = false;
t.is(actual, expected);
});
test('without against "always [\\.0-9]" should fail', async t => {
const [actual] = check(await parsed.without, 'always', '[\\.0-9]');
const expected = false;
t.is(actual, expected);
});
test('without against "never [\\.0-9]" should succeed', async t => {
const [actual] = check(await parsed.without, 'never', '[\\.0-9]');
const expected = true;
t.is(actual, expected);
});