diff --git a/@commitlint/rules/src/references-empty.test.js b/@commitlint/rules/src/references-empty.test.js index a491600b324..a414362999f 100644 --- a/@commitlint/rules/src/references-empty.test.js +++ b/@commitlint/rules/src/references-empty.test.js @@ -7,7 +7,8 @@ const messages = { plain: 'foo: bar', comment: 'foo: baz\n#1 Comment', reference: '#comment\nfoo: baz \nCloses #1', - references: '#comment\nfoo: bar \nCloses #1, #2, #3' + references: '#comment\nfoo: bar \nCloses #1, #2, #3', + prefix: 'bar REF-1234' }; const opts = (async () => { @@ -24,7 +25,10 @@ const parsed = { reference: (async () => parse(messages.reference, undefined, (await opts).parserOpts))(), references: (async () => - parse(messages.references, undefined, (await opts).parserOpts))() + parse(messages.references, undefined, (await opts).parserOpts))(), + prefix: parse(messages.prefix, undefined, { + issuePrefixes: ['REF-'] + }) }; test('defaults to never and fails for plain', async t => { @@ -74,3 +78,9 @@ test('fails for references with always', async t => { const expected = false; t.is(actual, expected); }); + +test('succeeds for custom references with always', async t => { + const [actual] = referencesEmpty(await parsed.prefix, 'never'); + const expected = true; + t.is(actual, expected); +});