Skip to content

Commit

Permalink
test(subject-full-stop): add two tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tehraninasab committed Feb 13, 2023
1 parent b3007ee commit 351578b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions @commitlint/rules/src/subject-full-stop.test.ts
Expand Up @@ -5,12 +5,16 @@ const messages = {
empty: 'test:\n',
with: `test: subject.\n`,
without: `test: subject\n`,
standardScopeWith: `type(scope): subject.\n`,
nonStandardScopeWith: "type.scope: subject.\n"
};

const parsed = {
empty: parse(messages.empty),
with: parse(messages.with),
without: parse(messages.without),
standardScopeWith: parse(messages.standardScopeWith),
nonStandardScopeWith: parse(messages.nonStandardScopeWith),
};

test('empty against "always" should succeed', async () => {
Expand Down Expand Up @@ -48,3 +52,15 @@ test('without against "never ." should succeed', async () => {
const expected = true;
expect(actual).toEqual(expected);
});

test('commit message title with standard scope and full-stop against "never ." should fail', async () => {
const [actual] = subjectFullStop(await parsed.standardScopeWith, 'never', '.');
const expected = false;
expect(actual).toEqual(expected);
});

test('commit message title with non standard scope and full-stop against "never ." should fail', async () => {
const [actual] = subjectFullStop(await parsed.nonStandardScopeWith, 'never', '.');
const expected = false;
expect(actual).toEqual(expected);
});

0 comments on commit 351578b

Please sign in to comment.