Skip to content

Commit d5fba83

Browse files
committed
test(rules): add issue prefix case
1 parent 11674b4 commit d5fba83

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

@commitlint/rules/src/references-empty.test.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const messages = {
77
plain: 'foo: bar',
88
comment: 'foo: baz\n#1 Comment',
99
reference: '#comment\nfoo: baz \nCloses #1',
10-
references: '#comment\nfoo: bar \nCloses #1, #2, #3'
10+
references: '#comment\nfoo: bar \nCloses #1, #2, #3',
11+
prefix: 'bar REF-1234'
1112
};
1213

1314
const opts = (async () => {
@@ -24,7 +25,10 @@ const parsed = {
2425
reference: (async () =>
2526
parse(messages.reference, undefined, (await opts).parserOpts))(),
2627
references: (async () =>
27-
parse(messages.references, undefined, (await opts).parserOpts))()
28+
parse(messages.references, undefined, (await opts).parserOpts))(),
29+
prefix: parse(messages.prefix, undefined, {
30+
issuePrefixes: ['REF-']
31+
})
2832
};
2933

3034
test('defaults to never and fails for plain', async t => {
@@ -74,3 +78,9 @@ test('fails for references with always', async t => {
7478
const expected = false;
7579
t.is(actual, expected);
7680
});
81+
82+
test('succeeds for custom references with always', async t => {
83+
const [actual] = referencesEmpty(await parsed.prefix, 'never');
84+
const expected = true;
85+
t.is(actual, expected);
86+
});

0 commit comments

Comments
 (0)