Skip to content

Commit

Permalink
Add test for valid scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomi committed Sep 2, 2024
1 parent 59d09e4 commit 5901827
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/validatePrTitle.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { validatePrTitle: validate } = require("./validatePrTitle");
const { ERRORS, NO_CHANGELOG } = require("./constants");
const { ERRORS, NO_CHANGELOG, SCOPES } = require("./constants");
const displayNamesModule = require("./getAllNodesDisplayNames");
const { TYPES } = require("./constants");
const {
Expand Down Expand Up @@ -98,6 +98,14 @@ describe("scope", () => {
.toHaveLength(1)
.toContain(ERRORS.INVALID_SCOPE + ". Did you mean `Gmail Trigger Node`?");
});

test.each(SCOPES)(
'Validation should pass for valid scope "%s"',
async (scope) => {
const issues = await validate(`feat(${scope}): Implement feature`);
expect(issues).toHaveLength(0);
},
);
});

describe("subject", () => {
Expand Down

0 comments on commit 5901827

Please sign in to comment.