Skip to content

Commit 54604f1

Browse files
committed
refactor: use parameterized tests for @, #, and Unicode validation
1 parent 4daa9b5 commit 54604f1

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

test/validate-branch-name.test.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,28 @@ describe("validateBranchName", () => {
3737
expect(() => validateBranchName("bugfix/JIRA-1234")).not.toThrow();
3838
});
3939

40-
it("should accept @ character (issue #998)", () => {
41-
expect(() => validateBranchName("TICKET-123@add-feature")).not.toThrow();
42-
expect(() => validateBranchName("user@branch")).not.toThrow();
43-
expect(() => validateBranchName("feat@test")).not.toThrow();
44-
});
45-
46-
it("should accept # character for Azure DevOps integration (issue #1024)", () => {
47-
expect(() => validateBranchName("feature/AB#1992-sentry-enhancements")).not.toThrow();
48-
expect(() => validateBranchName("AB#123-fix")).not.toThrow();
49-
expect(() => validateBranchName("issue#456")).not.toThrow();
50-
});
51-
52-
it("should accept Unicode characters for internationalization (issue #1020)", () => {
53-
expect(() => validateBranchName("feat/add-機能追加")).not.toThrow();
54-
expect(() => validateBranchName("フィーチャー/新機能")).not.toThrow();
55-
expect(() => validateBranchName("особенность/новая")).not.toThrow();
40+
it.each([
41+
"TICKET-123@add-feature",
42+
"user@branch",
43+
"feat@test",
44+
])("should accept @ character: %s", (branchName) => {
45+
expect(() => validateBranchName(branchName)).not.toThrow();
46+
});
47+
48+
it.each([
49+
"feature/AB#1992-sentry-enhancements",
50+
"AB#123-fix",
51+
"issue#456",
52+
])("should accept # character: %s", (branchName) => {
53+
expect(() => validateBranchName(branchName)).not.toThrow();
54+
});
55+
56+
it.each([
57+
"feat/add-機能追加",
58+
"フィーチャー/新機能",
59+
"особенность/новая",
60+
])("should accept Unicode characters: %s", (branchName) => {
61+
expect(() => validateBranchName(branchName)).not.toThrow();
5662
});
5763
});
5864

0 commit comments

Comments
 (0)