-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathfooter-leading-blank.js
109 lines (92 loc) · 3.55 KB
/
footer-leading-blank.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import test from 'ava';
import parse from '../../source/library/parse';
import footerLeadingBlank from '../../source/rules/footer-leading-blank';
const messages = {
simple: 'chore: subject',
body: 'chore: subject\nbody',
trailing: 'chore: subject\nbody\n\n',
without: 'chore: subject\nbody\nBREAKING CHANGE: something important',
with: 'chore: subject\nbody\n\nBREAKING CHANGE: something important'
};
const parsed = {
simple: parse(messages.simple),
body: parse(messages.body),
trailing: parse(messages.trailing),
without: parse(messages.without),
with: parse(messages.with)
};
test('footer-leading-blank with simple message should succeed for empty keyword', t => {
const [actual] = footerLeadingBlank(parsed.simple);
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with simple message should succeed for "never"', t => {
const [actual] = footerLeadingBlank(parsed.simple, 'never');
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with simple message should succeed for "always"', t => {
const [actual] = footerLeadingBlank(parsed.simple, 'always');
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with body message should succeed for empty keyword', t => {
const [actual] = footerLeadingBlank(parsed.body);
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with body message should succeed for "never"', t => {
const [actual] = footerLeadingBlank(parsed.body, 'never');
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with body message should succeed for "always"', t => {
const [actual] = footerLeadingBlank(parsed.body, 'always');
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with trailing message should succeed for empty keyword', t => {
const [actual] = footerLeadingBlank(parsed.trailing);
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with trailing message should succeed for "never"', t => {
const [actual] = footerLeadingBlank(parsed.trailing, 'never');
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with trailing message should succeed for "always"', t => {
const [actual] = footerLeadingBlank(parsed.trailing, 'always');
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank without blank line before footer should fail for empty keyword', t => {
const [actual] = footerLeadingBlank(parsed.without);
const expected = false;
t.is(actual, expected);
});
test('footer-leading-blank without blank line before footer should succeed for "never"', t => {
const [actual] = footerLeadingBlank(parsed.without, 'never');
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank without blank line before footer should fail for "always"', t => {
const [actual] = footerLeadingBlank(parsed.without, 'always');
const expected = false;
t.is(actual, expected);
});
test('footer-leading-blank with blank line before footer should succeed for empty keyword', t => {
const [actual] = footerLeadingBlank(parsed.with);
const expected = true;
t.is(actual, expected);
});
test('footer-leading-blank with blank line before footer should fail for "never"', t => {
const [actual] = footerLeadingBlank(parsed.with, 'never');
const expected = false;
t.is(actual, expected);
});
test('footer-leading-blank with blank line before footer should succeed for "always"', t => {
const [actual] = footerLeadingBlank(parsed.with, 'always');
const expected = true;
t.is(actual, expected);
});