diff --git a/src/__tests__/isValidCommitMessage.test.ts b/src/__tests__/isValidCommitMessage.test.ts new file mode 100644 index 0000000..5f33e4d --- /dev/null +++ b/src/__tests__/isValidCommitMessage.test.ts @@ -0,0 +1,12 @@ +import isValidCommitMessage from "../isValidCommitMesage"; + +test("should be able to correctly validate the commit message", () => { + expect(isValidCommitMessage("fix: menu must open on shortcut press")).toBe(true); + expect(isValidCommitMessage("something: should not work")).toBe(false); + expect(isValidCommitMessage("fixes something")).toBe(false); + expect(isValidCommitMessage("🚧 fix: menu must open on shortcut press")).toBe(true); + expect(isValidCommitMessage("fix(menus): menu must open on shortcut press")).toBe(true); + expect(isValidCommitMessage("🚧 fix(menus): menu must open on shortcut press")).toBe(true); + expect(isValidCommitMessage("🚧 fixing something")).toBe(false); + expect(isValidCommitMessage("🚧 something: should not work")).toBe(false); +});