From 6c264010679e846c7665bec270b7204151235259 Mon Sep 17 00:00:00 2001 From: Adrian Smijulj Date: Thu, 11 Jun 2020 12:51:50 +0200 Subject: [PATCH] test: create a basic test --- src/__tests__/isValidCommitMessage.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/__tests__/isValidCommitMessage.test.ts 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); +});