Skip to content

Commit dfc5db4

Browse files
committed
test(subject-full-sope): add two tests
1 parent b3007ee commit dfc5db4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

@commitlint/rules/src/subject-full-stop.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ const messages = {
55
empty: 'test:\n',
66
with: `test: subject.\n`,
77
without: `test: subject\n`,
8+
standardScopeWith: `type(scope): subject.\n`,
9+
nonStandardScopeWith: "type.scope: subject.\n"
810
};
911

1012
const parsed = {
1113
empty: parse(messages.empty),
1214
with: parse(messages.with),
1315
without: parse(messages.without),
16+
standardScopeWith: parse(messages.standardScopeWith),
17+
nonStandardScopeWith: parse(messages.nonStandardScopeWith),
1418
};
1519

1620
test('empty against "always" should succeed', async () => {
@@ -48,3 +52,15 @@ test('without against "never ." should succeed', async () => {
4852
const expected = true;
4953
expect(actual).toEqual(expected);
5054
});
55+
56+
test('commit message title with standard scope and full-stop against "never ." should fail', async () => {
57+
const [actual] = subjectFullStop(await parsed.standardScopeWith, 'never', '.');
58+
const expected = false;
59+
expect(actual).toEqual(expected);
60+
});
61+
62+
test('commit message title with non standard scope and full-stop against "never ." should fail', async () => {
63+
const [actual] = subjectFullStop(await parsed.nonStandardScopeWith, 'never', '.');
64+
const expected = false;
65+
expect(actual).toEqual(expected);
66+
});

0 commit comments

Comments
 (0)