Skip to content

Commit

Permalink
test(core): add cases for references
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Jan 9, 2018
1 parent 7e610e0 commit f3583a0
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions @commitlint/core/src/lint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,51 @@ test('throws for rule with out of range condition', async t => {
error.message.indexOf('header-max-length must be "always" or "never"') > -1
);
});

test('succeds for issue', async t => {
const report = await lint('somehting #1', {
'references-empty': [2, 'never']
});

t.true(report.valid);
});

test('fails for issue', async t => {
const report = await lint('somehting #1', {
'references-empty': [2, 'always']
});

t.false(report.valid);
});

test('succeds for custom issue prefix', async t => {
const report = await lint(
'somehting REF-1',
{
'references-empty': [2, 'never']
},
{
parserOpts: {
issuePrefixes: ['REF-']
}
}
);

t.true(report.valid);
});

test('fails for custom issue prefix', async t => {
const report = await lint(
'somehting #1',
{
'references-empty': [2, 'never']
},
{
parserOpts: {
issuePrefixes: ['REF-']
}
}
);

t.false(report.valid);
});

0 comments on commit f3583a0

Please sign in to comment.