Skip to content

Commit

Permalink
commitlintplugings.test: add failing tests
Browse files Browse the repository at this point in the history
Add failing tests for default-revert-message rule.
  • Loading branch information
tehraninasab committed Aug 9, 2023
1 parent a096b47 commit db4c07b
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions commitlint/plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,64 @@ test("proper-issue-refs5", () => {
expect(properIssueRefs5.status).not.toBe(0);
});

test("default-revert-message1", () => {
let commitMsgWithoutDefaultRevertMessage =
'Revert "add abbreviations.ts"\n\n' +
"This reverts commit 0272f587c7eece147e8d1756116b0b43e11c34ac.";
let defaultRevertMessage1 = runCommitLintOnMsg(
commitMsgWithoutDefaultRevertMessage
);
expect(defaultRevertMessage1.status).not.toBe(0);
});

test("default-revert-message2", () => {
let commitMsgWithDefaultRevertMessage =
'Revert "add abbreviations.ts"\n\n' +
"This reverts commit 0272f587c7eece147e8d1756116b0b43e11c34ac\n" +
"because/otherwise bla bla.";
let defaultRevertMessage2 = runCommitLintOnMsg(
commitMsgWithDefaultRevertMessage
);
expect(defaultRevertMessage2.status).toBe(0);
});

test("default-revert-message3", () => {
let commitMsgWithoutDefaultRevertMessage = 'Revert "add abbreviations.ts"';
let defaultRevertMessage3 = runCommitLintOnMsg(
commitMsgWithoutDefaultRevertMessage
);
expect(defaultRevertMessage3.status).not.toBe(0);
});

test("default-revert-message4", () => {
let commitMsgWithDefaultRevertMessage = "Revert .NET6 upd as it broke CI";
let defaultRevertMessage4 = runCommitLintOnMsg(
commitMsgWithDefaultRevertMessage
);
expect(defaultRevertMessage4.status).toBe(0);
});

test("default-revert-message5", () => {
let commitMsgWithoutDefaultRevertMessage =
'Revert "add abbreviations.ts"\n\n' +
"This reverts commit 0272f587 because bla bla.\n";

let defaultRevertMessage5 = runCommitLintOnMsg(
commitMsgWithoutDefaultRevertMessage
);
expect(defaultRevertMessage5.status).toBe(0);
});

test("default-revert-message6", () => {
let commitMsgWithDefaultRevertMessage =
'Revert "process overhaul" to fix CI\n\n';

let defaultRevertMessage6 = runCommitLintOnMsg(
commitMsgWithDefaultRevertMessage
);
expect(defaultRevertMessage6.status).toBe(0);
});

test("subject-lowercase1", () => {
let commitMsgWithUppercaseAfterColon = "foo: Bar baz";
let subjectLowerCase1 = runCommitLintOnMsg(
Expand Down

0 comments on commit db4c07b

Please sign in to comment.