Skip to content

Commit f3583a0

Browse files
committed
test(core): add cases for references
1 parent 7e610e0 commit f3583a0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

@commitlint/core/src/lint.test.js

+48
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,51 @@ test('throws for rule with out of range condition', async t => {
134134
error.message.indexOf('header-max-length must be "always" or "never"') > -1
135135
);
136136
});
137+
138+
test('succeds for issue', async t => {
139+
const report = await lint('somehting #1', {
140+
'references-empty': [2, 'never']
141+
});
142+
143+
t.true(report.valid);
144+
});
145+
146+
test('fails for issue', async t => {
147+
const report = await lint('somehting #1', {
148+
'references-empty': [2, 'always']
149+
});
150+
151+
t.false(report.valid);
152+
});
153+
154+
test('succeds for custom issue prefix', async t => {
155+
const report = await lint(
156+
'somehting REF-1',
157+
{
158+
'references-empty': [2, 'never']
159+
},
160+
{
161+
parserOpts: {
162+
issuePrefixes: ['REF-']
163+
}
164+
}
165+
);
166+
167+
t.true(report.valid);
168+
});
169+
170+
test('fails for custom issue prefix', async t => {
171+
const report = await lint(
172+
'somehting #1',
173+
{
174+
'references-empty': [2, 'never']
175+
},
176+
{
177+
parserOpts: {
178+
issuePrefixes: ['REF-']
179+
}
180+
}
181+
);
182+
183+
t.false(report.valid);
184+
});

0 commit comments

Comments
 (0)